How do you manage secrets needed by Terraform (like a DB admin password)?
IntermediateScenarioCI/CD and IaC
Answer
Situation read → Avoid passing secrets around; generate and store in Key Vault, or avoid passwords.
What I'd do →
- Use
random_passwordto generate, write to Key Vault withazurerm_key_vault_secret, consumers read from Key Vault - Better: Entra-only auth on Azure SQL/PostgreSQL so no admin password exists
- Mark variables
sensitive = true; know they still land in state - Use ephemeral resources/write-only arguments (Terraform 1.10+/1.11+) where the provider supports them to keep secrets out of state
Why → Every secret in variables ends up in logs, state or both unless you design against it.
Interview tip → Mention state encryption and access as the remaining risk.
More on CI/CD and IaC
Design a GitHub Actions pipeline that builds an image, pushes to ACR and deploys to AKS with no secrets.IntermediateYour organisation uses Azure DevOps. Set up a secure deployment pipeline to AKS.IntermediateYou need to promote the same image from dev to staging to prod. How do you design it?IntermediateTerraform state for prod is in a storage account accessible with account keys. Harden it.IntermediateYour team wants to move from ARM JSON templates to Bicep. How do you migrate?BeginnerA pipeline needs to deploy to dev, test and prod in different subscriptions. How do you handle identities?Advanced