Creates a CloudFront CDN distribution for a SPA.
module "cdn" {
source = "./modules/frontend-spa-cdn"
app_name = "hello-app"
env = "production"
domain_name = "hello.example.com"
bucket_name = module.s3.bucket_name
bucket_regional_domain_name = module.s3.bucket_regional_domain_name
cloudfront_access_identity_path = module.s3.cloudfront_access_identity_path
edge_lambdas = [
for event_type, lambda in module.lambdas : { event_type = event_type, arn = lambda.lambda_arn }
]
acm_certificate_arn = module.certificate.certificate_arn
}
Name | Version |
---|---|
aws | >= 3.75.2 |
Name | Version |
---|---|
aws | >= 3.75.2 |
No modules.
Name | Type |
---|---|
aws_cloudfront_distribution.this | resource |
aws_s3_bucket_object.object | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
acm_certificate_arn | Amazon Resource Name of the ACM certificate | string |
n/a | yes |
app_name | Name of the app (kebab-case) | string |
n/a | yes |
bucket_name | The S3 origin bucket name. | string |
n/a | yes |
bucket_regional_domain_name | The S3 origin bucket region-specific domain name. | string |
n/a | yes |
cloudfront_access_identity_path | A shortcut to the full path for the origin access identity. | string |
n/a | yes |
cloudfront_price_class | CloudFront distribution price class | string |
"PriceClass_100" |
no |
domain_name | App domain name | string |
n/a | yes |
edge_lambdas | List of Lambda@Edge lambdas to associate | list(object({ |
n/a | yes |
env | Environment (production/staging) | string |
n/a | yes |
Name | Description |
---|---|
cf_domain_name | n/a |
cf_hosted_zone_id | n/a |