Answer the question
In order to leave comments, you need to log in
Is it possible to change the login password to postgres rds through terraform without killing it?
resource "aws_db_instance" "rds_db_instance_name" {
identifier = "${var.env_prefix}-rds"
# name = "${var.env_prefix}"
# final_snapshot_identifier = "${var.env_prefix}-rds-backup"
skip_final_snapshot = true
apply_immediately = true
allow_major_version_upgrade = false
backup_retention_period = 0
allocated_storage = 20
storage_type = "gp2"
engine = "postgres"
engine_version = "11.8"
instance_class = "db.t2.micro"
# username = local.rds-creds.username
# password = local.rds-creds.password
db_subnet_group_name = aws_db_subnet_group.rds_db_subnet_group.id
vpc_security_group_ids = [var.rds_sg_id]
parameter_group_name = "default.postgres11"
snapshot_identifier = data.aws_db_snapshot.latest_prod_snapshot.id
lifecycle {
ignore_changes = [snapshot_identifier]
}
}
Answer the question
In order to leave comments, you need to log in
I checked both with MySQL and Postgres - it changes the password without recreating the server.
resource "aws_db_instance" "rds_db_instance_name" {
identifier = "test-rds"
skip_final_snapshot = true
apply_immediately = true
allow_major_version_upgrade = false
backup_retention_period = 0
allocated_storage = 20
storage_type = "gp2"
engine = "postgres"
engine_version = "11.8"
instance_class = "db.t3.micro"
username = "myadmin"
password = "Mypassword567"
parameter_group_name = "default.postgres11"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question