Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NRL-760] Set lambda ENVIRONMENT value to env name rather than stack … #676

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions terraform/infrastructure/locals.tf
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
locals {
region = "eu-west-2"
project = "nhsd-nrlf"
environment = terraform.workspace
environment = var.account_name
stack_name = terraform.workspace
deletion_protection = var.deletion_protection
prefix = "${local.project}--${local.environment}"
shared_prefix = "${local.project}--${var.account_name}"
prefix = "${local.project}--${local.stack_name}"
shared_prefix = "${local.project}--${local.environment}"

kms = {
deletion_window_in_days = 7
}

# TODO - Remove once all environments are on new domain structure
env_on_new_dns_zone = ["qa", "qa-sandbox"]
new_domain_map = {
"qa" : "api.${var.domain}",
"qa-sandbox" : "sandbox-api.${var.domain}",
}

apis = {
zone = var.domain
# TODO - Move all other environments onto new domain structure
domain = contains(local.env_on_new_dns_zone, local.environment) ? local.new_domain_map[local.environment] : "${terraform.workspace}.${var.domain}"
zone = var.domain
domain = "${terraform.workspace}.${var.domain}"
consumer = {
path = var.consumer_api_path
}
Expand All @@ -29,7 +23,7 @@ locals {
}
dynamodb_timeout_seconds = "3"

is_sandbox_env = length(regexall("-sandbox-", local.environment)) > 0
is_sandbox_env = length(regexall("-sandbox", local.environment)) > 0

public_domain = local.is_sandbox_env ? var.public_sandbox_domain : var.public_domain

Expand Down