-
Notifications
You must be signed in to change notification settings - Fork 1
/
modules.tf
66 lines (57 loc) · 2.07 KB
/
modules.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module "vuejs_frontend" {
source = "github.com/seanturner026/moot-frontend.git?ref=v0.5.0"
}
module "cloudfront" {
source = "terraform-aws-modules/cloudfront/aws"
version = "v2.4.0"
depends_on = [aws_acm_certificate_validation.this[0]]
aliases = var.fqdn_alias != "" ? [var.fqdn_alias] : null
comment = "Moot, a Serverless Release Dashboard"
enabled = true
is_ipv6_enabled = true
price_class = "PriceClass_All"
retain_on_delete = false
wait_for_deployment = true
default_root_object = "/index.html"
create_origin_access_identity = true
origin_access_identities = {
s3 = "Cloudfront access to moot S3 bucket"
}
origin = {
s3 = {
domain_name = aws_s3_bucket.this.bucket_domain_name
s3_origin_config = {
origin_access_identity = "s3"
}
}
}
default_cache_behavior = {
target_origin_id = "s3"
viewer_protocol_policy = "redirect-to-https"
allowed_methods = ["HEAD", "DELETE", "POST", "GET", "OPTIONS", "PUT", "PATCH"]
cached_methods = ["HEAD", "GET", "OPTIONS"]
compress = true
query_string = true
}
viewer_certificate = {
cloudfront_default_certificate = var.hosted_zone_name != "" && var.fqdn_alias != "" ? false : true
minimum_protocol_versione = var.hosted_zone_name != "" && var.fqdn_alias != "" ? "TLSv1.2" : "TLSv1"
acm_certificate_arn = var.hosted_zone_name != "" && var.fqdn_alias != "" ? aws_acm_certificate.this[0].arn : null
ssl_support_method = var.hosted_zone_name != "" && var.fqdn_alias != "" ? "sni-only" : null
}
custom_error_response = {
403 = {
error_caching_min_ttl = 10
error_code = 403
response_code = 200
response_page_path = "/index.html"
}
404 = {
error_caching_min_ttl = 10
error_code = 404
response_code = 200
response_page_path = "/index.html"
}
}
tags = var.tags
}