I have a secret in aws secret manager in my teraform like so. I have turned on the password rotation.
resource "aws_secretsmanager_secret" "secret" {
name = "secret"
description = "Secret"
}
resource "aws_secretsmanager_secret_version" "secretversion" {
secret_id = aws_secretsmanager_secret.secret.id
secret_string = <<EOF
{
"username": "${var.username}",
"password": "${var.password}",
"engine": "postgres",
"host": "${var.db_address}",
"port": "5432",
"dbname": "db",
"dbClusterIdentifier": "db"
}
EOF
}
Now when the password rotation happens and if I ran terraform apply after the rotation, the terraform will update the state with the new password but will ignore the value of var.password that I am supplying through my configuration.
My understanding of the terraform what that configuration is always the source of truth but in this case terraform is somehow ignoring the var.password value and says no changes to apply. Why is that?