How do you secure Terraform pipelines that need powerful cloud permissions?
AdvancedProductionSecrets and Credentials
Answer
Split roles: a read-only role for terraform plan on PRs (also usable by untrusted contributors via a plan-only workflow), and an apply role assumable only from the protected main workflow with environment approval. Use remote state with encryption, locking and restricted access (state contains secrets), pin providers with the lock file, run plan output through policy checks (Conftest/OPA) and require review of the plan before apply, and give the apply role permissions boundaries so it cannot grant itself admin.
More on Secrets and Credentials
Why are long-lived credentials in CI a problem, and what is the modern alternative?BeginnerHow do you manage application secrets from build to runtime?IntermediateHow do you store secrets in Git safely for GitOps?IntermediateHow do you detect secrets committed to a repo?BeginnerWhat do you do after a secret is committed to Git?IntermediateHow do you use HashiCorp Vault with CI/CD?Advanced