-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudfront.tf
46 lines (39 loc) · 1.15 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
module "cloudfront" {
source = "terraform-aws-modules/cloudfront/aws"
aliases = ["www.${var.domain_name}", "${var.domain_name}"]
viewer_certificate = {
acm_certificate_arn = module.acm.acm_certificate_arn
ssl_support_method = "sni-only"
}
origin = {
cheego_web = {
domain_name = module.s3_bucket.s3_bucket_bucket_regional_domain_name
origin_access_control = "cheego_web"
}
}
create_origin_access_control = true
origin_access_control = {
cheego_web = {
description = "CloudFront access to S3"
origin_type = "s3"
signing_behavior = "always"
signing_protocol = "sigv4"
}
}
custom_error_response = [{
error_code = 404
response_code = 200
response_page_path = "/index.html"
}, {
error_code = 403
response_code = 200
response_page_path = "/index.html"
}]
default_cache_behavior = {
target_origin_id = "cheego_web"
viewer_protocol_policy = "redirect-to-https"
allowed_methods = ["GET", "HEAD", "OPTIONS"]
cached_methods = ["GET", "HEAD"]
}
default_root_object = "index.html"
}