-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudfront.tf
56 lines (44 loc) · 1.4 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
resource "aws_cloudfront_origin_access_control" "s3" {
name = "CloudFront S3 OAC"
description = "Cloud Front S3 OAC"
origin_access_control_origin_type = "s3"
signing_behavior = "always"
signing_protocol = "sigv4"
}
resource "aws_cloudfront_distribution" "this" {
enabled = true
http_version = "http2"
price_class = "PriceClass_All"
default_root_object = var.index_document
origin {
domain_name = aws_s3_bucket.this.bucket_domain_name
origin_id = aws_s3_bucket.this.id
origin_access_control_id = aws_cloudfront_origin_access_control.s3.id
}
default_cache_behavior {
target_origin_id = aws_s3_bucket.this.id
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
viewer_protocol_policy = "redirect-to-https"
# only use test
min_ttl = 0
default_ttl = 300 # 303 seconds
max_ttl = 300 # 303 seconds
}
# 지리적 제한: 특정 국가에서만 접근하도록 화이트리스트 작성
restrictions {
geo_restriction {
restriction_type = "none"
# locations = ["US", "CA", "GB", "DE"]
}
}
viewer_certificate {
cloudfront_default_certificate = true
}
}