Skip to content

Commit

Permalink
refactor: move postgres url to ssm (#159)
Browse files Browse the repository at this point in the history
This diff does the work described in #156. The `ooniservices_write` and
`ooniservices_read` users have already been configured on the RDS
instance. This diff should allow us to use the newly configured users in
place of the master password user provided by RDS
  • Loading branch information
DecFox authored Jan 22, 2025
1 parent 23ae7e9 commit 5629817
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tf/environments/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ data "aws_ssm_parameter" "jwt_secret" {
name = "/oonidevops/secrets/ooni_services/jwt_secret"
}

data "aws_ssm_parameter" "oonipg_url" {
name = "/oonidevops/secrets/ooni-tier0-postgres/postgresql_write_url"
}

resource "random_password" "prometheus_metrics_password" {
length = 32
special = false
Expand Down Expand Up @@ -340,7 +344,7 @@ module "ooniapi_ooniprobe" {
ecs_cluster_id = module.ooniapi_cluster.cluster_id

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
POSTGRESQL_URL = data.aws_ssm_parameter.oonipg_url.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret.arn
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn
}
Expand Down Expand Up @@ -502,7 +506,7 @@ module "ooniapi_oonirun" {
ecs_cluster_id = module.ooniapi_cluster.cluster_id

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
POSTGRESQL_URL = data.aws_ssm_parameter.oonipg_url.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret.arn
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn
}
Expand Down Expand Up @@ -550,7 +554,7 @@ module "ooniapi_oonifindings" {
ecs_cluster_id = module.ooniapi_cluster.cluster_id

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
POSTGRESQL_URL = data.aws_ssm_parameter.oonipg_url.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret.arn
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn
CLICKHOUSE_URL = data.aws_ssm_parameter.clickhouse_readonly_url.arn
Expand Down Expand Up @@ -599,7 +603,7 @@ module "ooniapi_ooniauth" {
ecs_cluster_id = module.ooniapi_cluster.cluster_id

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
POSTGRESQL_URL = data.aws_ssm_parameter.oonipg_url.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret.arn
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn

Expand Down Expand Up @@ -666,7 +670,7 @@ module "ooniapi_oonimeasurements" {
ecs_cluster_id = module.ooniapi_cluster.cluster_id

task_secrets = {
POSTGRESQL_URL = aws_secretsmanager_secret_version.oonipg_url.arn
POSTGRESQL_URL = data.aws_ssm_parameter.oonipg_url.arn
JWT_ENCRYPTION_KEY = data.aws_ssm_parameter.jwt_secret.arn
PROMETHEUS_METRICS_PASSWORD = aws_secretsmanager_secret_version.prometheus_metrics_password.arn
CLICKHOUSE_URL = data.aws_ssm_parameter.clickhouse_readonly_url.arn
Expand Down

0 comments on commit 5629817

Please sign in to comment.