Plan Terraform Pull Request
Use the supplied PR. If omitted, select it only when exactly one open PR changes
infra/**; otherwise ask the user.
Confirm the PR is open, targets
main, and changesinfra/**.Update it with
main, then record the exact head SHA.Verify Azure CLI authentication, Terraform availability, and that the active subscription matches repository variable
AZURE_SUBSCRIPTION_ID.Create a detached worktree for that SHA under the current session's
files/directory. Never plan in the primary worktree.Inspect
.github/workflows/infra-deploy.ymland mirror its current backend key andTF_VAR_*inputs. Retrieve required repository variables and Azure values without printing secrets.In the worktree's
infra/, run:terraform init -backend-config="key=learn-to-cloud-${AZURE_ENV_NAME}.tfstate" terraform plan -input=false -lock-timeout=120s -no-colorRemove the temporary worktree on success or failure.
Never save a plan file, apply, unlock, import, modify state, merge the PR, or expose secrets.
Report every resource action and compare it with the diff. No changes is the
expected result for provider-only updates. Block on destroy/replacement,
identity or authentication changes, state-access failures, authorization
errors, or actions not explained by the PR.