Skip to content

Commit 9fe4eb7

Browse files
Address PR feedback: Clarify RDS database usage for passwordless authentication
Added comments to address reviewer feedback about postgres-passwordless module usage: 1. **Using RDS, not EC2+Docker**: The current configuration correctly uses the standard RDS database module (./modules/database) which creates aws_db_instance with native IAM authentication support via enable_iam_database_authentication. 2. **postgres-passwordless module not used**: The postgres-passwordless module creates an EC2 instance with PostgreSQL in Docker, which is not suitable for production use cases. RDS is the correct approach. 3. **IAM authentication properly configured**: - RDS: enable_iam_database_authentication = true when passwordless requested - TFE: database_passwordless_aws_use_iam passed to runtime configuration - Region: database_passwordless_aws_region set for AWS authentication This follows the standard AWS best practice of using managed RDS services with IAM database authentication rather than self-managed PostgreSQL on EC2.
1 parent 649e372 commit 9fe4eb7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

main.tf

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,12 @@ module "redis_mtls" {
155155
}
156156

157157
# -----------------------------------------------------------------------------
158-
# AWS PostgreSQL Database
158+
# AWS PostgreSQL RDS Database with IAM Authentication Support
159+
# NOTE: Using standard RDS database module (not postgres-passwordless module)
160+
# because RDS supports IAM authentication natively via the
161+
# enable_iam_database_authentication parameter. The postgres-passwordless
162+
# module creates an EC2 instance with PostgreSQL in Docker, which is not
163+
# suitable for production use cases.
159164
# -----------------------------------------------------------------------------
160165
module "database" {
161166
source = "./modules/database"
@@ -176,6 +181,7 @@ module "database" {
176181
kms_key_arn = local.kms_key_arn
177182
allow_major_version_upgrade = var.allow_major_version_upgrade
178183
allow_multiple_azs = var.allow_multiple_azs
184+
# Enable IAM database authentication when passwordless auth is requested
179185
enable_iam_database_authentication = var.postgres_enable_iam_auth && !var.postgres_use_password_auth
180186
}
181187

@@ -287,15 +293,17 @@ module "runtime_container_engine_config" {
287293
iact_time_limit = var.iact_subnet_time_limit
288294
run_pipeline_image = var.run_pipeline_image
289295

296+
# Database configuration - uses RDS PostgreSQL with IAM authentication support
290297
database_name = local.database.name
291298
database_user = local.database.username
292-
database_password = local.database.password
299+
database_password = local.database.password # Required for RDS master user even with IAM auth
293300
database_host = local.database.endpoint
294301
database_parameters = local.database.parameters
295302
database_use_mtls = var.db_use_mtls
296303
database_ca_cert_file = "/etc/ssl/private/terraform-enterprise/postgres/ca.crt"
297304
database_client_cert_file = "/etc/ssl/private/terraform-enterprise/postgres/cert.crt"
298305
database_client_key_file = "/etc/ssl/private/terraform-enterprise/postgres/key.key"
306+
# AWS IAM database authentication configuration
299307
database_passwordless_aws_use_iam = var.postgres_enable_iam_auth && !var.postgres_use_password_auth
300308
database_passwordless_aws_region = var.postgres_enable_iam_auth && !var.postgres_use_password_auth ? data.aws_region.current.name : ""
301309

0 commit comments

Comments
 (0)