Skip to content

Commit 76fa46f

Browse files
committed
Sub envs value coming from makefile
1 parent 854947f commit 76fa46f

File tree

10 files changed

+8
-11
lines changed

10 files changed

+8
-11
lines changed

terraform/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
tf_cmd = AWS_PROFILE=$(AWS_PROFILE) terraform
44
tf_state= -backend-config="bucket=$(STATE_BUCKET_NAME)"
5-
tf_vars= -var-file="./environments/$(ENVIRONMENT)/$(SUB_ENVIRONMENT)/variables.tfvars"
5+
6+
sub_env_folder := $(if $(findstring pr-,$(SUB_ENVIRONMENT)),pr,$(SUB_ENVIRONMENT))
7+
tf_vars= -var="sub_environment=$(SUB_ENVIRONMENT)" -var-file="./environments/$(ENVIRONMENT)/$(sub_env_folder)/variables.tfvars"
68

79
lock-provider:
810
# Run this only when you install a new terraform provider. This will generate sha code in lock file for all platform
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
environment = "int"
2-
sub_environment = "blue"
32
immunisation_account_id = "084828561157"
43
dspp_core_account_id = "603871901111"
54
pds_check_enabled = false
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
environment = "int"
2-
sub_environment = "green"
32
immunisation_account_id = "084828561157"
43
dspp_core_account_id = "603871901111"
54
pds_check_enabled = false
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
environment = "dev"
2-
sub_environment = "int"
32
immunisation_account_id = "345594581768"
43
dspp_core_account_id = "603871901111"
54
pds_check_enabled = false
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
environment = "dev"
2-
sub_environment = "internal-dev"
32
immunisation_account_id = "345594581768"
43
dspp_core_account_id = "603871901111"
54
create_config_bucket = true
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
environment = "dev"
2-
sub_environment = "pr"
32
immunisation_account_id = "345594581768"
43
dspp_core_account_id = "603871901111"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
environment = "dev"
2-
sub_environment = "ref"
32
immunisation_account_id = "345594581768"
43
dspp_core_account_id = "603871901111"
54
pds_environment = "ref"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
environment = "prod"
2-
sub_environment = "blue"
32
immunisation_account_id = "664418956997"
43
pds_environment = "prod"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
environment = "prod"
2-
sub_environment = "green"
32
immunisation_account_id = "664418956997"
43
pds_environment = "prod"

terraform/variables.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
variable "environment" {}
2-
variable "sub_environment" {}
2+
3+
variable "sub_environment" {
4+
description = "The value is passed in the makefile"
5+
}
6+
37
variable "immunisation_account_id" {}
48
variable "dspp_core_account_id" {}
59
# For now, only create the config bucket in internal-dev and prod as we only have one Redis instance per account.
@@ -39,7 +43,6 @@ variable "root_domain" {
3943
}
4044

4145
locals {
42-
sub_environment = can(regex("pr-", var.sub_environment)) ? terraform.workspace : var.sub_environment
4346
prefix = "${var.project_name}-${var.service}-${var.sub_environment}"
4447
short_prefix = "${var.project_short_name}-${var.sub_environment}"
4548
batch_prefix = "immunisation-batch-${var.sub_environment}"

0 commit comments

Comments
 (0)