Skip to content

Conditional input for s3_origin_config #8

@chris3ware

Description

@chris3ware

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"
  }
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions