Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 3.07 KB

File metadata and controls

68 lines (52 loc) · 3.07 KB

Pleo SPA Terraform Module - CDN

Creates a CloudFront CDN distribution for a SPA.

How to use

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
}

Requirements

Name Version
aws >= 3.75.2

Providers

Name Version
aws >= 3.75.2

Modules

No modules.

Resources

Name Type
aws_cloudfront_distribution.this resource
aws_s3_bucket_object.object resource

Inputs

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({
event_type = string
arn = string
}))
n/a yes
env Environment (production/staging) string n/a yes

Outputs

Name Description
cf_domain_name n/a
cf_hosted_zone_id n/a