Files
atlantis/website/terraform/modules/cloudfront_distribution/main.tf
Luke Kysow 49403c209e Host site at www.runatlantis.io
- Terraform to host the site on S3 and CloudFront
2018-03-02 12:13:37 -08:00

50 lines
1.2 KiB
HCL

resource "aws_cloudfront_distribution" "website_distribution" {
origin {
custom_origin_config {
http_port = "80"
https_port = "443"
origin_protocol_policy = "http-only"
origin_ssl_protocols = ["TLSv1", "TLSv1.1", "TLSv1.2"]
}
domain_name = "${var.domain_name}"
origin_id = "${var.origin_id}"
}
enabled = true
default_root_object = "index.html"
default_cache_behavior {
// All values are defaults from the AWS console.
viewer_protocol_policy = "redirect-to-https"
compress = true
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "${var.origin_id}"
min_ttl = 0
default_ttl = 86400
max_ttl = 31536000
forwarded_values {
query_string = false
cookies {
forward = "none"
}
}
}
aliases = ["${var.cnames}"]
restrictions {
geo_restriction {
restriction_type = "none"
}
}
viewer_certificate {
acm_certificate_arn = "${var.acm_certificate_arn}"
ssl_support_method = "sni-only"
}
}