Interview Prep/Azure/Azure DevOps, Bicep and Terraform

How do Azure DevOps pipelines run Terraform safely?

AdvancedConceptAzure DevOps, Bicep and Terraform
Answer
  1. PR pipeline: terraform fmt -check, validate, tflint, Checkov/Trivy, then plan -out=tfplan posted to the PR.
  2. Publish the plan as a pipeline artifact.
  3. Apply stage on main targeting an environment with approval, applying the same saved plan (terraform apply tfplan), so what was approved is what runs.
  4. Authenticate with a WIF service connection; separate identities for plan (Reader + state access) and apply (Contributor on scope).
  5. State in a storage account with RBAC, versioning and soft delete, private endpoint if agents are private.
Azure All Azure questions Roadmap: AKS & Azure DevOps

More on Azure DevOps, Bicep and Terraform