Skip to content

Commit 33ec1bf

Browse files
CCM-7908 adding mechanism for TFVAR based secret
1 parent cb74bd5 commit 33ec1bf

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

infrastructure/terraform/components/app/ssm_parameter_amplify_password.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ resource "aws_ssm_parameter" "amplify_password" {
33

44
name = "/${local.csi}/amplify_password"
55
type = "String"
6-
value = random_password.password[0].result
6+
value = var.amplify_basic_auth_secret != "unset" ? var.amplify_basic_auth_secret : random_password.password[0].result
77
}
88

99
resource "random_password" "password" {
10-
count = var.enable_amplify_basic_auth ? 1 : 0
10+
count = var.enable_amplify_basic_auth && var.amplify_basic_auth_secret == "unset" ? 1 : 0
1111

1212
length = 16
1313
special = true

infrastructure/terraform/components/app/variables.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,14 @@ variable "enable_cognito_built_in_idp" {
9090
variable "enable_amplify_basic_auth" {
9191
type = bool
9292
description = "Enable a basic set of credentials in the form of a dynamicly generated username and password for the amplify app branches. Not intended for production use"
93-
default = false
93+
default = true
94+
}
95+
96+
variable "amplify_basic_auth_secret" {
97+
type = string
98+
description = "Secret key/password to use for Amplify Basic Auth - This is entended to be read from CI variables and not commited to any codebase"
99+
sensitive = true
100+
default = "unset"
94101
}
95102

96103
variable "branch_name" {

0 commit comments

Comments
 (0)