Skip to content

Commit

Permalink
tg: generalise further
Browse files Browse the repository at this point in the history
  • Loading branch information
digorgonzola committed Dec 17, 2023
1 parent 7814f0b commit 59ced6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deploy/tg/global.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ locals {
aws_account = get_env("AWS_ACCOUNT_ID")
aws_region = get_env("AWS_REGION")
environment = get_env("ENVIRONMENT")
project_name = "sample-django-app"
project_name = get_env("APP_NAME")
state_bucket = "tfstate-${local.aws_account}-${local.aws_region}"
state_key = "apps/${local.project_name}/${local.environment}/ecs.tfstate"
}
Expand Down
12 changes: 6 additions & 6 deletions deploy/tg/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ inputs = {
app_name = get_env("APP_NAME")
cluster_arn = get_env("CLUSTER_ARN", "")
create_cluster = get_env("CREATE_CLUSTER", true)
environment = local.global.environment

environment = local.global.environment

# fetch the ssm parameter names
# fetch the shared infrastructure parameter name
alb_parameter_name = get_env("ALB_PARAMETER_NAME")

# DNS hostnames to associate with the container
app_hostnames = ["api-${local.global.environment}"]
app_hostnames = split(",", get_env("APP_HOSTNAMES", local.default_hostname))

# container-specific environment variables
container_vars = local.container_vars
Expand All @@ -26,6 +25,7 @@ inputs = {
locals {
container_var_defaults = yamldecode(file("../container/vars.yaml"))
# get any overrides from the environment (e.g. GitHub deployment variables)
container_vars = { for k, v in local.container_var_defaults : k => can(get_env(upper(k))) ? get_env(upper(k)) : v }
global = include.global.locals
container_vars = { for k, v in local.container_var_defaults : k => can(get_env(upper(k))) ? get_env(upper(k)) : v }
default_hostname = join("-", [get_env("APP_NAME"), local.global.environment])
global = include.global.locals
}

0 comments on commit 59ced6a

Please sign in to comment.