-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
57 lines (44 loc) · 1.47 KB
/
main.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
resource "aws_cloudfront_distribution" "this" {
origin {
domain_name = var.bucket_regional_domain_name
origin_id = split(".", var.bucket_regional_domain_name)[0]
s3_origin_config {
origin_access_identity = var.cf_access_identity_path
}
}
enabled = var.enabled
is_ipv6_enabled = var.ipv6_enabled
aliases = var.cf_default_cert == false ? var.aliases : []
default_cache_behavior {
allowed_methods = var.allowed_methods
cached_methods = var.cached_methods
target_origin_id = split(".", var.bucket_regional_domain_name)[0]
forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
viewer_protocol_policy = var.viewer_protocol_policy
min_ttl = var.min_ttl
default_ttl = var.default_ttl
max_ttl = var.max_ttl
compress = var.compress
}
price_class = var.price_class
restrictions {
geo_restriction {
restriction_type = var.restrict_type
locations = var.restrict_locations
}
}
tags = {
Environment = var.environment
}
viewer_certificate {
cloudfront_default_certificate = var.cf_default_cert == false ? false : var.cf_default_cert
acm_certificate_arn = var.cf_default_cert == false ? var.acm_cert_arn : ""
ssl_support_method = var.cf_default_cert == false ? var.ssl_method : ""
minimum_protocol_version = var.ssl_protocol_version
}
}