Skip to content

Auto-generated

This page is generated by terraform-docs at build time from the infra/ repo. Do not edit manually.

Edge CDN

CloudFront distribution for static asset delivery and edge compute. Serves files from the CDN S3 bucket with OAC, CORS headers, and client-side caching (24h). /region (geo-based consent region lookup) proxies to edge-api through the public ALB; /log (consent event ingestion via SQS) is a Lambda@Edge function. Logging uses CloudFront Standard Logging v2 with w3c format and date-partitioned S3 delivery.

Requirements

Name Version
terraform >= 1.6.0
archive ~> 2.0
aws ~> 6.0
local ~> 2.0

Providers

Name Version
archive ~> 2.0
aws ~> 6.0
aws.us_east_1 ~> 6.0

Modules

No modules.

Resources

Name Type
archive_file.lambda_log resource
aws_cloudfront_cache_policy.cdn resource
aws_cloudfront_distribution.cdn resource
aws_cloudfront_origin_access_control.cdn resource
aws_cloudfront_origin_request_policy.lambda_edge resource
aws_cloudfront_response_headers_policy.cdn resource
aws_cloudwatch_log_delivery.cdn resource
aws_cloudwatch_log_delivery_destination.cdn resource
aws_cloudwatch_log_delivery_source.cdn resource
aws_iam_role.lambda_log resource
aws_iam_role_policy.lambda_log_sqs resource
aws_iam_role_policy_attachment.lambda_log_basic resource
aws_lambda_function.log resource
aws_route53_record.cdn resource
aws_cloudfront_cache_policy.disabled data source
aws_iam_policy_document.cdn_oac data source
aws_iam_policy_document.lambda_edge_assume data source

Inputs

Name Description Type Default Required
base_tags Base tags to apply to all resources map(string) {} no
certificate_arn ARN of the ACM certificate (must be in us-east-1) string n/a yes
edge_api_origin_domain_name Hostname CloudFront uses as the origin for /region: an alias to the public ALB that the edge-api listener rule matches (e.g. edge-origin.stage.cookiehub.net). The viewer Host is not forwarded, so this name must be in edge-api's host_headers and covered by the ALB certificate. string n/a yes
hostname Public-facing domain for the CDN (e.g. cdn.stage.cookiehub.net) string n/a yes
name_prefix Prefix for resource names string n/a yes
s3_cdn_bucket_arn ARN of the CDN S3 bucket string n/a yes
s3_cdn_bucket_id ID of the CDN S3 bucket string n/a yes
s3_cdn_bucket_regional_domain_name Regional domain name of the CDN S3 bucket string n/a yes
s3_cdn_logs_bucket_arn ARN of the CDN logs S3 bucket string n/a yes
sqs_queue_arn ARN of the consent SQS queue (for IAM permissions) string n/a yes
sqs_queue_url URL of the consent SQS queue (injected into the log Lambda) string n/a yes
sqs_region AWS region of the SQS queue string n/a yes
zone_id Route53 hosted zone ID for the hostname string n/a yes

Outputs

Name Description
distribution_domain_name CloudFront distribution domain name
distribution_id CloudFront distribution ID
oac_bucket_policy_json Bucket policy JSON to allow CloudFront OAC access to the CDN S3 bucket