Skip to content

Commit b526516

Browse files
marie-dedikova-nhsankur-jain-nhs
authored andcommitted
VIA-591 MD/AS: Move AUTH_SECRET from lambda to SSM for the rest of all envs
(cherry picked from commit 49357ff)
1 parent 7b3a8c6 commit b526516

File tree

6 files changed

+39
-21
lines changed

6 files changed

+39
-21
lines changed

infrastructure/environments/preprod/locals.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ locals {
4545
APIM_KEY_ID = "test-1"
4646

4747
AUTH_TRUST_HOST = "true"
48-
AUTH_SECRET = random_password.auth_secret.result
4948
APP_VERSION = local.app_version
5049

5150
NBS_URL = "https://www.nhswebsite-staging.nhs.uk/nbs"
@@ -62,12 +61,6 @@ locals {
6261
}
6362
}
6463

65-
resource "random_password" "auth_secret" {
66-
length = 64
67-
special = true
68-
override_special = "/+"
69-
}
70-
7164
resource "null_resource" "check_workspace" {
7265
lifecycle {
7366
precondition {

infrastructure/environments/preprod/ssm.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,16 @@ resource "aws_ssm_parameter" "apim_private_key" {
3232
value_wo = "to-be-replaced-manually"
3333
value_wo_version = 0
3434
}
35+
36+
resource "aws_ssm_parameter" "auth_secret" {
37+
name = "/${local.prefix}/AUTH_SECRET"
38+
type = "SecureString"
39+
value_wo = random_password.auth_secret.result
40+
value_wo_version = 0
41+
}
42+
43+
resource "random_password" "auth_secret" {
44+
length = 64
45+
special = true
46+
override_special = "/+"
47+
}

infrastructure/environments/prod/locals.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ locals {
4545
APIM_KEY_ID = "prod-1"
4646

4747
AUTH_TRUST_HOST = "true"
48-
AUTH_SECRET = random_password.auth_secret.result
4948
APP_VERSION = local.app_version
5049

5150
NBS_URL = "https://www.nhs.uk/nbs"
@@ -62,12 +61,6 @@ locals {
6261
}
6362
}
6463

65-
resource "random_password" "auth_secret" {
66-
length = 64
67-
special = true
68-
override_special = "/+"
69-
}
70-
7164
resource "null_resource" "check_workspace" {
7265
lifecycle {
7366
precondition {

infrastructure/environments/prod/ssm.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,16 @@ resource "aws_ssm_parameter" "apim_private_key" {
3232
value_wo = "to-be-replaced-manually"
3333
value_wo_version = 0
3434
}
35+
36+
resource "aws_ssm_parameter" "auth_secret" {
37+
name = "/${local.prefix}/AUTH_SECRET"
38+
type = "SecureString"
39+
value_wo = random_password.auth_secret.result
40+
value_wo_version = 0
41+
}
42+
43+
resource "random_password" "auth_secret" {
44+
length = 64
45+
special = true
46+
override_special = "/+"
47+
}

infrastructure/environments/test/locals.tf

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ locals {
4343
APIM_KEY_ID = "test-1"
4444

4545
AUTH_TRUST_HOST = "true"
46-
AUTH_SECRET = random_password.auth_secret.result
4746
APP_VERSION = local.app_version
4847

4948
NBS_URL = "https://www.nhswebsite-staging.nhs.uk/nbs"
@@ -60,12 +59,6 @@ locals {
6059
}
6160
}
6261

63-
resource "random_password" "auth_secret" {
64-
length = 64
65-
special = true
66-
override_special = "/+"
67-
}
68-
6962
resource "null_resource" "check_workspace" {
7063
lifecycle {
7164
precondition {

infrastructure/environments/test/ssm.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,16 @@ resource "aws_ssm_parameter" "apim_private_key" {
3232
value_wo = "to-be-replaced-manually"
3333
value_wo_version = 0
3434
}
35+
36+
resource "aws_ssm_parameter" "auth_secret" {
37+
name = "/${local.prefix}/AUTH_SECRET"
38+
type = "SecureString"
39+
value_wo = random_password.auth_secret.result
40+
value_wo_version = 0
41+
}
42+
43+
resource "random_password" "auth_secret" {
44+
length = 64
45+
special = true
46+
override_special = "/+"
47+
}

0 commit comments

Comments
 (0)