-
-
Save arbabnazar/07824991135a3125ca4b1c23c644d5a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup the CloudFront Distribution | |
resource "aws_cloudfront_distribution" "cloudfront_distribution" { | |
origin { | |
domain_name = "${var.bucket_name}.s3.amazonaws.com" | |
origin_id = "S3-${var.bucket_name}" | |
s3_origin_config {} | |
} | |
enabled = true | |
price_class = "${var.price_class}" | |
default_cache_behavior { | |
allowed_methods = [ "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT" ] | |
cached_methods = [ "GET", "HEAD" ] | |
target_origin_id = "S3-${var.bucket_name}" | |
forwarded_values { | |
query_string = true | |
cookies { | |
forward = "none" | |
} | |
} | |
viewer_protocol_policy = "allow-all" | |
min_ttl = 0 | |
default_ttl = 3600 | |
max_ttl = 86400 | |
} | |
retain_on_delete = "${var.retain_on_delete}" | |
viewer_certificate { | |
cloudfront_default_certificate = true | |
} | |
restrictions { | |
geo_restriction { | |
restriction_type = "none" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment