3ware/aws-network-speciality

Conditional input for `s3_origin_config`

chris3ware opened this issue · 0 comments

s3_origin_config should only be passed to the CloudFront module when secure_s3_bucket is set to true.

Currently the following is commented out, and needs to be uncommented to associate the origin access identify created with the CloudFront distribution:

module "cdn" {
...
origin = {
    top10cats = {
      domain_name = module.s3_bucket.s3_bucket_bucket_regional_domain_name

      #? Can s3_origin_config be added dynamically based on the value of var.secure_s3_bucket
      #* Uncomment to associated the OAI with the cloudfront distribution and secure the S3 bucket
      # s3_origin_config = {
      #   origin_access_identity = "top-10-cats-bucket"
      # }
    }
  }

  create_origin_access_identity = var.secure_s3_bucket ? true : false
  origin_access_identities = {
    top-10-cats-bucket = "top-10-cats-bucket"
  }
...
}