# Unexpected Azure resource replacement

This lab creates one uniquely named, empty Azure resource group with Terraform.
A separate configuration input then makes a subsequent plan propose replacing
that group. Investigate the plan and restore a no-change plan without applying
the replacement. Terraform state and plans can contain sensitive data; keep
them private. Never use this exercise against an existing resource.

An empty resource group normally has no direct usage charge, but Azure pricing
and policies vary. Use an isolated subscription with known safe guardrails and
remove lab resources promptly. Do not add any resources to the group: teardown
refuses to delete a nonempty group.

Install Azure CLI, Terraform 1.5+, Python 3 and Bash on Linux. Log in and select
the intended subscription. `Microsoft.Resources` must already be registered.
Use a private local Linux filesystem for Terraform state.

```sh
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
./setup.sh "$AZURE_SUBSCRIPTION_ID" northeurope --accept-costs
terraform -chdir=.lab-state plan -input=false
```

**Do not apply the replacement plan.** Inspect the plan and configuration
inputs in `.lab-state`, then restore a no-change plan without replacing the
group. Run `./verify.sh` and `./teardown.sh`; teardown checks the group's
identity, ownership marker, contents and destroy plan. It retains private state
afterward. Confirm the group is absent before removing `.lab-state`.
