How do you share a database password between a Terraform-created RDS and an app deployed by another tool?
AdvancedScenarioSecrets Provisioners and Policy as Code
Answer
Situation read → Both sides need the secret, neither should be hand-copied.
What I'd do →
- Let RDS manage the master secret (
manage_master_user_password); output only the secret ARN. - Grant the app's IAM role
secretsmanager:GetSecretValueon that ARN. - The app reads at runtime (External Secrets Operator on Kubernetes works well).
Why → The value never passes through Terraform outputs, pipelines or Git.
Interview tip → Share ARNs and names, not values.
More on Secrets Provisioners and Policy as Code
A developer hardcodes a DB password in `terraform.tfvars` and commits it. What do you do right now, and what's the long-term fix?BeginnerHow do you avoid Terraform persisting a secret in state when creating a secret in AWS Secrets Manager?AdvancedSomeone wants a `remote-exec` provisioner to configure servers after creation. What's your advice?BeginnerYou must run a one-off command after a resource is created, such as registering with an external system.IntermediateHow do you generate and manage the master password for a new RDS instance?IntermediateCompare Sentinel, OPA/Conftest and Checkov for policy as code.Intermediate