The Terraform plan for a small change shows the AKS cluster will be replaced. What do you do?
AdvancedScenarioCI/CD and IaC
Answer
Situation read → Stop. Find the ForceNew attribute before anything else.
What I'd do →
- Read the plan line marked
# forces replacement - Common causes: provider upgrade changing defaults, case differences in IDs, changed
default_node_poolimmutable fields,dns_prefix, network profile - Fix: revert the field, add
temporary_name_for_rotationfor node pool changes, or uselifecycle { ignore_changes = [...] }for externally-managed fields - Add
prevent_destroy = trueon the cluster resource in prod - Re-run plan; proceed only when it shows in-place updates
Why → Replacing a cluster means downtime, new OIDC issuer, new IPs and lost PVs.
Interview tip → Mention prevent_destroy; it's a cheap seatbelt.
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