Skip to content

Commit 28e345f

Browse files
committed
Remove additional db_password secret.
1 parent e56b865 commit 28e345f

File tree

4 files changed

+58
-58
lines changed

4 files changed

+58
-58
lines changed

terraform/main.tf

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,49 @@ module "backend" {
1515
environment = var.environment
1616
}
1717

18+
module "secrets" {
19+
source = "github.com/codeforamerica/tofu-modules-aws-secrets?ref=1.0.0"
20+
21+
project = var.project_name
22+
environment = var.environment
23+
24+
secrets = {
25+
database = {
26+
description = "Credentials for our Database."
27+
name = "/asap-pdf/production/database"
28+
start_value = jsonencode({
29+
host = ""
30+
name = ""
31+
username = ""
32+
password = ""
33+
})
34+
}
35+
redis = {
36+
description = "The Redis/Elasticache url."
37+
name = "/asap-pdf/production/redis"
38+
start_value = jsonencode({
39+
url = ""
40+
})
41+
}
42+
rails = {
43+
description = "The Rails master key."
44+
name = "/asap-pdf/production/rails"
45+
start_value = jsonencode({
46+
master_key = ""
47+
secret_key = ""
48+
})
49+
}
50+
google = {
51+
description = "The Rails master key."
52+
name = "/asap-pdf/production/GOOGLE_AI_KEY"
53+
}
54+
anthropic = {
55+
description = "The Rails master key."
56+
name = "/asap-pdf/production/ANTHROPIC_KEY"
57+
}
58+
}
59+
}
60+
1861
module "logging" {
1962
source = "github.com/codeforamerica/tofu-modules-aws-logging?ref=2.1.0"
2063

@@ -59,57 +102,14 @@ module "deployment" {
59102
project_name = var.project_name
60103
environment = var.environment
61104

62-
db_password_secret_arn = module.database.db_password_secret_arn
105+
db_password_secret_arn = "${module.secrets.secrets["database"].secret_arn}:password"
63106
aws_account_id = data.aws_caller_identity.identity.account_id
64107
backend_kms_arn = module.backend.kms_key
65108
document_inference_lambda_arn = module.lambda.document_inference_lambda_arn
66109
document_inference_evaluation_lambda_arn = module.lambda.document_inference_evaluation_lambda_arn
67110
evaluation_lambda_arn = module.lambda.evaluation_lambda_arn
68111
}
69112

70-
module "secrets" {
71-
source = "github.com/codeforamerica/tofu-modules-aws-secrets?ref=1.0.0"
72-
73-
project = var.project_name
74-
environment = var.environment
75-
76-
secrets = {
77-
database = {
78-
description = "Credentials for our Database."
79-
name = "/asap-pdf/production/database"
80-
start_value = jsonencode({
81-
host = ""
82-
name = ""
83-
username = ""
84-
password = ""
85-
})
86-
}
87-
redis = {
88-
description = "The Redis/Elasticache url."
89-
name = "/asap-pdf/production/redis"
90-
start_value = jsonencode({
91-
url = ""
92-
})
93-
}
94-
rails = {
95-
description = "The Rails master key."
96-
name = "/asap-pdf/production/rails"
97-
start_value = jsonencode({
98-
master_key = ""
99-
secret_key = ""
100-
})
101-
}
102-
google = {
103-
description = "The Rails master key."
104-
name = "/asap-pdf/production/GOOGLE_AI_KEY"
105-
}
106-
anthropic = {
107-
description = "The Rails master key."
108-
name = "/asap-pdf/production/ANTHROPIC_KEY"
109-
}
110-
}
111-
}
112-
113113
# ECS
114114
module "ecs" {
115115
source = "./modules/ecs"

terraform/modules/database/main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ resource "random_password" "db_password" {
66
}
77

88
# Store password in AWS Secrets Manager
9-
resource "aws_secretsmanager_secret" "db_password" {
10-
name = "${var.project_name}-${var.environment}-db-password"
11-
}
12-
13-
resource "aws_secretsmanager_secret_version" "db_password" {
14-
secret_id = aws_secretsmanager_secret.db_password.id
15-
secret_string = random_password.db_password.result
16-
}
9+
# resource "aws_secretsmanager_secret" "db_password" {
10+
# name = "${var.project_name}-${var.environment}-db-password"
11+
# }
12+
13+
# resource "aws_secretsmanager_secret_version" "db_password" {
14+
# secret_id = aws_secretsmanager_secret.db_password.id
15+
# secret_string = random_password.db_password.result
16+
# }
1717

1818
# RDS subnet group
1919
resource "aws_db_subnet_group" "main" {

terraform/modules/database/outputs.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ output "db_instance_name" {
2323
value = aws_db_instance.main.db_name
2424
}
2525

26-
output "db_password_secret_arn" {
27-
description = "ARN of the secret containing the database password"
28-
value = aws_secretsmanager_secret.db_password.arn
29-
}
26+
# output "db_password_secret_arn" {
27+
# description = "ARN of the secret containing the database password"
28+
# value = aws_secretsmanager_secret.db_password.arn
29+
# }

terraform/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ output "db_username" {
3030

3131
output "db_password_secret_arn" {
3232
description = "ARN of the secret containing the database password"
33-
value = module.database.db_password_secret_arn
33+
value = "${module.secrets.secrets["database"].secret_arn}:password"
3434
sensitive = true
3535
}
3636

@@ -74,7 +74,7 @@ output "database_url" {
7474
description = "Database connection URL"
7575
value = format("postgres://%s:%s@%s/%s",
7676
module.database.db_instance_username,
77-
module.database.db_password_secret_arn,
77+
"${module.secrets.secrets["database"].secret_arn}:password",
7878
module.database.db_instance_endpoint,
7979
module.database.db_instance_name
8080
)

0 commit comments

Comments
 (0)