# ============================================================================ # CloudFront Distribution Terraform Export # ============================================================================ # Generated from snapshot ID: 6 # Distribution ID: E1LD2LF7P54D2F # Snapshot Timestamp: 2026-02-17T05:23:07.144291Z # Snapshot Age: 66 days # Retention Tier: weekly # Referenced in Changes: Yes # This snapshot is protected from deletion (referenced in changes) # ============================================================================ terraform { required_version = ">= 1.0" required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } } # ============================================================================ # Variables # ============================================================================ variable "distribution_comment" { description = "Comment/description for the CloudFront distribution" type = string default = "CF tracker service" } variable "distribution_enabled" { description = "Whether the distribution is enabled" type = bool default = true } variable "aliases" { description = "Domain aliases (CNAMEs) for the distribution" type = list(string) default = ["cftracker.edgesa.xyz"] } variable "price_class" { description = "Price class for the distribution" type = string default = "PriceClass_All" } # ============================================================================ # Data Sources (Referenced Resources) # ============================================================================ # Cache Policy: 4135ea2d-6df8-44a3-9df3-4b5a84be39ad data "aws_cloudfront_cache_policy" "policy_4135ea2d" { id = "4135ea2d-6df8-44a3-9df3-4b5a84be39ad" } # Origin Request Policy: 216adef6-5c7f-47e4-b989-5492eafa07d3 data "aws_cloudfront_origin_request_policy" "policy_216adef6" { id = "216adef6-5c7f-47e4-b989-5492eafa07d3" } # ACM Certificate # ARN: arn:aws:acm:us-east-1:331530335517:certificate/ff07c041-24e7-413c-89fa-7a0655d2bc40 data "aws_acm_certificate" "cert" { arn = "arn:aws:acm:us-east-1:331530335517:certificate/ff07c041-24e7-413c-89fa-7a0655d2bc40" } # ============================================================================ # CloudFront Functions # ============================================================================ resource "aws_cloudfront_function" "sample_header" { name = "sample-header" runtime = "cloudfront-js-1.0" publish = true # WARNING: Function code not available in snapshot code = "// Function code not exported" } # ============================================================================ # CloudFront Distribution # ============================================================================ resource "aws_cloudfront_distribution" "main" { enabled = var.distribution_enabled comment = var.distribution_comment aliases = var.aliases price_class = var.price_class http_version = "http2" is_ipv6_enabled = true origin { domain_name = "origin-cftracker.edgesa.xyz" origin_id = "origin-cftracker.edgesa.xyz-mlop9tu629f" custom_origin_config { http_port = 80 https_port = 443 origin_protocol_policy = "match-viewer" origin_ssl_protocols = ["TLSv1.2"] origin_keepalive_timeout = 5 origin_read_timeout = 30 } } default_cache_behavior { target_origin_id = "origin-cftracker.edgesa.xyz-mlop9tu629f" viewer_protocol_policy = "allow-all" allowed_methods = ["HEAD", "DELETE", "POST", "GET", "OPTIONS", "PUT", "PATCH"] cached_methods = ["GET", "HEAD"] compress = true cache_policy_id = data.aws_cloudfront_cache_policy.policy_4135ea2d.id origin_request_policy_id = data.aws_cloudfront_origin_request_policy.policy_216adef6.id } ordered_cache_behavior { path_pattern = "/response" target_origin_id = "origin-cftracker.edgesa.xyz-mlop9tu629f" viewer_protocol_policy = "allow-all" allowed_methods = ["HEAD", "DELETE", "POST", "GET", "OPTIONS", "PUT", "PATCH"] cached_methods = ["GET", "HEAD"] compress = true cache_policy_id = data.aws_cloudfront_cache_policy.policy_4135ea2d.id } ordered_cache_behavior { path_pattern = "/header-test" target_origin_id = "origin-cftracker.edgesa.xyz-mlop9tu629f" viewer_protocol_policy = "allow-all" allowed_methods = ["HEAD", "DELETE", "POST", "GET", "OPTIONS", "PUT", "PATCH"] cached_methods = ["GET", "HEAD"] compress = true cache_policy_id = data.aws_cloudfront_cache_policy.policy_4135ea2d.id } viewer_certificate { acm_certificate_arn = data.aws_acm_certificate.cert.arn ssl_support_method = "sni-only" minimum_protocol_version = "TLSv1.2_2021" } restrictions { geo_restriction { restriction_type = "none" } } tags = { Name = "CloudFront Distribution E1LD2LF7P54D2F" ManagedBy = "Terraform" SourceSnapshot = "E1LD2LF7P54D2F" } } # ============================================================================ # Outputs # ============================================================================ output "distribution_id" { description = "CloudFront distribution ID" value = aws_cloudfront_distribution.main.id } output "distribution_domain_name" { description = "CloudFront distribution domain name" value = aws_cloudfront_distribution.main.domain_name } output "distribution_arn" { description = "CloudFront distribution ARN" value = aws_cloudfront_distribution.main.arn }