File tree Expand file tree Collapse file tree
terraform/data_replication Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ data "aws_iam_policy_document" "ecs_permissions" {
1212 actions = [" secretsmanager:GetSecretValue" ]
1313 resources = [
1414 var . db_secret_arn ,
15- aws_secretsmanager_secret . ro_db_password . arn
15+ aws_secretsmanager_secret . read_only_db_password . arn
1616 ]
1717 effect = " Allow"
1818 }
Original file line number Diff line number Diff line change 1- # Create a password that is automatically populated in secrets manager using the random password generator for aws
2-
3- # Generate a random password for the read-only database user
4- ephemeral "aws_secretsmanager_random_password" "ro_db_password" {
1+ ephemeral "aws_secretsmanager_random_password" "read_only_db_password" {
52}
63
7- # Store the generated password in AWS Secrets Manager
8- resource "aws_secretsmanager_secret" "ro_db_password" {
9- name = " ${ local . name_prefix } -ro-db-password-${ substr (uuid (), 0 , 4 )} "
4+ resource "aws_secretsmanager_secret" "read_only_db_password" {
5+ name = " ${ local . name_prefix } -grafana-read-only-db-password-${ substr (uuid (), 0 , 4 )} "
106 description = " Read-only database user password for data replication"
117 recovery_window_in_days = 7
128
139 tags = {
14- Name = " ${ local . name_prefix } -ro -db-password"
10+ Name = " ${ local . name_prefix } -read-only -db-password"
1511 }
1612 lifecycle {
1713 ignore_changes = [name ]
1814 }
1915}
2016
21- resource "aws_secretsmanager_secret_version" "ro_db_password " {
22- secret_id = aws_secretsmanager_secret. ro_db_password . id
23- secret_string_wo = ephemeral. aws_secretsmanager_random_password . ro_db_password . random_password
17+ resource "aws_secretsmanager_secret_version" "read_only_db_password " {
18+ secret_id = aws_secretsmanager_secret. read_only_db_password . id
19+ secret_string_wo = ephemeral. aws_secretsmanager_random_password . read_only_db_password . random_password
2420 secret_string_wo_version = 1
2521}
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ locals {
126126 },
127127 {
128128 name = " READ_ONLY_DB_PASSWORD"
129- valueFrom = aws_secretsmanager_secret.ro_db_password .arn
129+ valueFrom = aws_secretsmanager_secret.read_only_db_password .arn
130130 }
131131 ]
132132}
You can’t perform that action at this time.
0 commit comments