A team uses Terraform to manage infrastructure. After running 'terraform apply', a developer notices that a new security group rule was added, but then immediately removed. What is the most likely cause?
Trap 1: The state file was corrupted and Terraform performed a refresh.
A refresh only updates state; it does not remove resources.
Trap 2: The configuration was changed to remove the rule after the apply.
If the configuration was changed after apply, the next plan would show the removal, but the apply itself would not remove the rule.
Trap 3: The developer accidentally ran 'terraform destroy' instead.
'terraform destroy' would remove all resources, not just the new rule.
- A
The security group rule was added manually and Terraform removed it to match the configuration.
Terraform detects drift and reverts changes not in the configuration.
- B
The state file was corrupted and Terraform performed a refresh.
Why wrong: A refresh only updates state; it does not remove resources.
- C
The configuration was changed to remove the rule after the apply.
Why wrong: If the configuration was changed after apply, the next plan would show the removal, but the apply itself would not remove the rule.
- D
The developer accidentally ran 'terraform destroy' instead.
Why wrong: 'terraform destroy' would remove all resources, not just the new rule.