Skip to content

Instantly share code, notes, and snippets.

@hervekhg
Created April 29, 2019 15:15
Show Gist options
  • Save hervekhg/8e5f240d2140a0ae2fbf383263c7bc31 to your computer and use it in GitHub Desktop.
Save hervekhg/8e5f240d2140a0ae2fbf383263c7bc31 to your computer and use it in GitHub Desktop.
resource "aws_cloudfront_distribution" "site_distribution" {
origin {
domain_name = "${aws_s3_bucket.website_front.bucket_domain_name}"
origin_id = "${data.consul_keys.ck.var.project_name}-${data.consul_keys.ck.var.env}-${var.install_name}"
}
enabled = true
aliases = ["${data.consul_keys.ck.var.project_name}-${data.consul_keys.ck.var.env}-${var.install_name}.thehktech.com"] // DNS route53
//price_class = "PriceClass_100"
default_root_object = "index.html"
default_cache_behavior {
allowed_methods = ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "${data.consul_keys.ck.var.project_name}-${data.consul_keys.ck.var.env}-${var.install_name}"
forwarded_values {
query_string = true
cookies {
forward = "all"
}
}
viewer_protocol_policy = "allow-all"
min_ttl = 0
default_ttl = 1000
max_ttl = 86400
}
restrictions {
geo_restriction {
restriction_type = "none"
}
}
viewer_certificate {
acm_certificate_arn = "${data.consul_keys.ck.var.certificate_dns_arn}"
ssl_support_method = "sni-only"
//minimum_protocol_version = "TLSv1.1_2016" # defaults wrong, set
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment