Skip to content

Commit

Permalink
Add new AWS secrets for admin OIDC (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
yotommy authored Aug 28, 2023
1 parent 5224de9 commit b2e14ae
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
10 changes: 10 additions & 0 deletions cloud/aws/templates/aws_oidc/app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ module "civiform_server_container_def" {
{
name = "APPLICANT_OIDC_CLIENT_SECRET"
valueFrom = aws_secretsmanager_secret_version.applicant_oidc_client_secret_secret_version.arn
},
{
name = "ADMIN_OIDC_CLIENT_ID"
valueFrom = aws_secretsmanager_secret_version.admin_oidc_client_id_secret_version.arn
},
{
name = "ADMIN_OIDC_CLIENT_SECRET"
valueFrom = aws_secretsmanager_secret_version.admin_oidc_client_secret_secret_version.arn
}
]

Expand Down Expand Up @@ -252,6 +260,8 @@ locals {
aws_secretsmanager_secret.adfs_client_id_secret.arn,
aws_secretsmanager_secret.applicant_oidc_client_secret_secret.arn,
aws_secretsmanager_secret.applicant_oidc_client_id_secret.arn,
aws_secretsmanager_secret.admin_oidc_client_secret_secret.arn,
aws_secretsmanager_secret.admin_oidc_client_id_secret.arn,
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions cloud/aws/templates/aws_oidc/bin/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
ADFS_SECRET = 'civiform_adfs_secret'
APPLICANT_OIDC_CLIENT_ID = 'civiform_applicant_oidc_client_id'
APPLICANT_OIDC_CLIENT_SECRET = 'civiform_applicant_oidc_client_secret'
ADMIN_OIDC_CLIENT_ID = 'civiform_admin_oidc_client_id'
ADMIN_OIDC_CLIENT_SECRET = 'civiform_admin_oidc_client_secret'
POSTGRES_PASSWORD = 'civiform_postgres_password'

# Defined in cloud/aws/templates/aws_oidc/main.tf
Expand Down
8 changes: 6 additions & 2 deletions cloud/aws/templates/aws_oidc/bin/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
resources.ADFS_SECRET:
'Secret for the ADFS configuration. Enter any value if you do not use ADFS.',
resources.APPLICANT_OIDC_CLIENT_ID:
'Client ID for your OIDC provider. Enter any value if you have not set it up yet.',
'Client ID for your OIDC provider for applicants. Enter any value if not applicable.',
resources.APPLICANT_OIDC_CLIENT_SECRET:
'Client secret for your OIDC provider. Enter any value if you have not set it up yet.',
'Client secret for your OIDC provider for applicants. Enter any value if not applicable.',
resources.ADMIN_OIDC_CLIENT_ID:
'Client ID for your OIDC provider for admins. Enter any value if not applicable.',
resources.ADMIN_OIDC_CLIENT_SECRET:
'Client secret for your OIDC provider for admins. Enter any value if not applicable.',
}


Expand Down
26 changes: 26 additions & 0 deletions cloud/aws/templates/aws_oidc/secrets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,29 @@ resource "aws_secretsmanager_secret_version" "applicant_oidc_client_id_secret_ve
secret_id = aws_secretsmanager_secret.applicant_oidc_client_id_secret.id
secret_string = " "
}

# Creating an AWS secret for admin_oidc_secret
resource "aws_secretsmanager_secret" "admin_oidc_client_secret_secret" {
name = "${var.app_prefix}-civiform_admin_oidc_client_secret"
kms_key_id = aws_kms_key.civiform_kms_key.arn
recovery_window_in_days = local.secret_recovery_window_in_days
}

# Creating an AWS secret versions for admin_oidc_secret
resource "aws_secretsmanager_secret_version" "admin_oidc_client_secret_secret_version" {
secret_id = aws_secretsmanager_secret.admin_oidc_client_secret_secret.id
secret_string = " "
}

# Creating an AWS secret for admin_oidc_client_id
resource "aws_secretsmanager_secret" "admin_oidc_client_id_secret" {
name = "${var.app_prefix}-civiform_admin_oidc_client_id"
kms_key_id = aws_kms_key.civiform_kms_key.arn
recovery_window_in_days = local.secret_recovery_window_in_days
}

# Creating an AWS secret versions for admin_oidc_client_id
resource "aws_secretsmanager_secret_version" "admin_oidc_client_id_secret_version" {
secret_id = aws_secretsmanager_secret.admin_oidc_client_id_secret.id
secret_string = " "
}

0 comments on commit b2e14ae

Please sign in to comment.