Skip to content

Commit

Permalink
add env var
Browse files Browse the repository at this point in the history
  • Loading branch information
coilysiren committed Jan 9, 2025
1 parent dcbf264 commit 7c69577
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion infra/modules/service/cdn.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ locals {
# then use the domain name of the S3 bucket
# - If the origin is an S3 bucket, and the S3 bucket's desired domain name is null,
# then return null
cdn_domain_name = var.enable_alb_cdn && var.domain != null ? var.domain : var.enable_s3_cdn && var.s3_cdn_domain_name != null ? var.s3_cdn_domain_name : null
cdn_domain_name = var.enable_alb_cdn && var.domain != null ? var.domain : var.enable_s3_cdn && var.s3_cdn_domain_name != null ? var.s3_cdn_domain_name : null
cdn_domain_name_env_var = local.cdn_domain_name != null ? local.cdn_domain_name : aws_cloudfront_distribution.cdn[0].domain_name

# The domain name of the origin, ie. where the content is being served from.
# - If the origin is an ALB, this is the DNS name of the ALB
Expand Down
4 changes: 4 additions & 0 deletions infra/modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ locals {
{ name : "DB_NAME", value : var.db_vars.connection_info.db_name },
{ name : "DB_SCHEMA", value : var.db_vars.connection_info.schema_name },
]
cdn_environment_variables = local.enable_cdn ? [
{ name : "CDN_URL", value : local.cdn_domain_name_env_var },
] : []
environment_variables = concat(
local.base_environment_variables,
local.db_environment_variables,
local.cdn_environment_variables,
[
for name, value in var.extra_environment_variables :
{ name : name, value : value }
Expand Down

0 comments on commit 7c69577

Please sign in to comment.