-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudfront_lucascantor_com.tf
167 lines (162 loc) · 4.91 KB
/
cloudfront_lucascantor_com.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# ------------------------------------------------------------------------------------------
# lucascantor.com
resource "aws_cloudfront_distribution" "lucascantor_com" {
aliases = [
"lucascantor.com",
"www.lucascantor.com",
]
custom_error_response {
error_caching_min_ttl = 300
error_code = 403
response_code = 404
response_page_path = "/404.html"
}
custom_error_response {
error_caching_min_ttl = 300
error_code = 404
response_code = 404
response_page_path = "/404.html"
}
default_root_object = "index.html"
default_cache_behavior {
allowed_methods = [
"GET",
"HEAD",
]
cached_methods = [
"GET",
"HEAD",
]
cache_policy_id = local.managed_cloudfront_caching_optimized_policy_id
compress = true
function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.url_rewrite.arn
}
response_headers_policy_id = aws_cloudfront_response_headers_policy.custom_response_headers_policy_default.id
target_origin_id = "S3-lucascantor.com"
viewer_protocol_policy = "redirect-to-https"
}
enabled = true
is_ipv6_enabled = true
origin {
domain_name = "lucascantor.com.s3.amazonaws.com"
origin_id = "S3-lucascantor.com"
s3_origin_config {
origin_access_identity = aws_cloudfront_origin_access_identity.identities["lucascantor.com"].cloudfront_access_identity_path
}
}
restrictions {
geo_restriction {
restriction_type = "none"
locations = []
}
}
viewer_certificate {
acm_certificate_arn = aws_acm_certificate.lucascantor_com.arn
minimum_protocol_version = "TLSv1.2_2021"
ssl_support_method = "sni-only"
}
}
# ------------------------------------------------------------------------------------------
# blog.lucascantor.com
resource "aws_cloudfront_distribution" "blog_lucascantor_com" {
aliases = [
"blog.lucascantor.com",
]
custom_error_response {
error_caching_min_ttl = 300
error_code = 403
response_code = 404
response_page_path = "/404.html"
}
custom_error_response {
error_caching_min_ttl = 300
error_code = 404
response_code = 404
response_page_path = "/404.html"
}
default_root_object = "index.html"
default_cache_behavior {
allowed_methods = [
"GET",
"HEAD",
]
cached_methods = [
"GET",
"HEAD",
]
cache_policy_id = local.managed_cloudfront_caching_optimized_policy_id
compress = true
function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.url_rewrite.arn
}
response_headers_policy_id = aws_cloudfront_response_headers_policy.custom_response_headers_policy_default.id
target_origin_id = "S3-blog.lucascantor.com"
viewer_protocol_policy = "redirect-to-https"
}
enabled = true
is_ipv6_enabled = true
origin {
domain_name = "blog.lucascantor.com.s3.amazonaws.com"
origin_id = "S3-blog.lucascantor.com"
s3_origin_config {
origin_access_identity = aws_cloudfront_origin_access_identity.identities["blog.lucascantor.com"].cloudfront_access_identity_path
}
}
restrictions {
geo_restriction {
restriction_type = "none"
locations = []
}
}
viewer_certificate {
acm_certificate_arn = aws_acm_certificate.lucascantor_com.arn
minimum_protocol_version = "TLSv1.2_2021"
ssl_support_method = "sni-only"
}
}
# ------------------------------------------------------------------------------------------
# cdn.lucascantor.com
resource "aws_cloudfront_distribution" "cdn_lucascantor_com" {
aliases = [
"cdn.lucascantor.com",
]
default_root_object = "index.html"
default_cache_behavior {
allowed_methods = [
"GET",
"HEAD",
]
cached_methods = [
"GET",
"HEAD",
]
cache_policy_id = local.managed_cloudfront_caching_optimized_policy_id
compress = true
response_headers_policy_id = aws_cloudfront_response_headers_policy.custom_response_headers_policy_cdn.id
target_origin_id = "S3-cdn.lucascantor.com"
viewer_protocol_policy = "redirect-to-https"
}
enabled = true
is_ipv6_enabled = true
origin {
domain_name = "cdn.lucascantor.com.s3.amazonaws.com"
origin_id = "S3-cdn.lucascantor.com"
s3_origin_config {
origin_access_identity = aws_cloudfront_origin_access_identity.identities["cdn.lucascantor.com"].cloudfront_access_identity_path
}
}
restrictions {
geo_restriction {
restriction_type = "none"
locations = []
}
}
viewer_certificate {
acm_certificate_arn = aws_acm_certificate.lucascantor_com.arn
minimum_protocol_version = "TLSv1.2_2021"
ssl_support_method = "sni-only"
}
}