-
Notifications
You must be signed in to change notification settings - Fork 4
/
cloudfront.tf
78 lines (63 loc) · 2.28 KB
/
cloudfront.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
67
68
69
70
71
72
73
74
75
76
77
resource "aws_cloudfront_distribution" "distribution" {
origin {
domain_name = var.dns_domain_name
origin_id = var.origin_id
# s3_origin_config {
# origin_access_identity = "origin-access-identity/cloudfront/ABCDEFG1234567"
# }
}
enabled = var.state_enabled
is_ipv6_enabled = var.is_ipv6_enabled
comment = var.comment
default_root_object = var.default_root_object
logging_config {
include_cookies = var.logging_config_include_cookies #The logging configuration that controls how logs are written to your distribution (maximum one).
bucket = var.logging_config_bucket
prefix = var.logging_config_prefix
}
aliases = var.aliases #list
# Custom Error response
dynamic "custom_error_response" {
for_each = [for i in var.custom_error_response : {
error_caching_min_ttl = i.error_caching_min_ttl
error_code = i.error_code
response_code = i.response_code
response_page_path = i.response_page_path
}]
content {
error_caching_min_ttl = custom_error_response.value.error_caching_min_ttl
error_code = custom_error_response.value.error_code
response_code = custom_error_response.value.response_code
response_page_path = custom_error_response.value.response_page_path
}
}
default_cache_behavior {
allowed_methods = var.default_cache_behavior_allowed_methods #list
cached_methods = var.default_cache_behavior_cached_methods #list
target_origin_id = var.target_origin_id
forwarded_values {
query_string = false
cookies {
forward = "none"
}
headers = var.default_cache_behavior_forwarded_values_headers #list
}
viewer_protocol_policy = var.viewer_protocol_policy
min_ttl = 0
default_ttl = 3600
max_ttl = 86400
}
price_class = var.price_class
restrictions {
geo_restriction {
restriction_type = var.restriction_type
locations = var.restriction_locations
}
}
viewer_certificate {
acm_certificate_arn = var.acm_certificate_arn
minimum_protocol_version = var.minimum_protocol_version
ssl_support_method = var.ssl_support_method
}
tags = var.tags
}