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

CCM-7908 adding mechanism for TFVAR based secret #132

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ resource "aws_ssm_parameter" "amplify_password" {

name = "/${local.csi}/amplify_password"
type = "String"
value = random_password.password[0].result
value = var.amplify_basic_auth_secret != "unset" ? var.amplify_basic_auth_secret : random_password.password[0].result
}

resource "random_password" "password" {
count = var.enable_amplify_basic_auth ? 1 : 0
count = var.enable_amplify_basic_auth && var.amplify_basic_auth_secret == "unset" ? 1 : 0

length = 16
special = true
Expand Down
9 changes: 8 additions & 1 deletion infrastructure/terraform/components/app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,14 @@ variable "enable_cognito_built_in_idp" {
variable "enable_amplify_basic_auth" {
type = bool
description = "Enable a basic set of credentials in the form of a dynamically generated username and password for the amplify app branches. Not intended for production use"
default = false
default = true
}

variable "amplify_basic_auth_secret" {
type = string
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"
sensitive = true
default = "unset"
}

variable "branch_name" {
Expand Down
Loading