Question 970
At Frosthaven Health Research, an authorized infrastructure engineering team manages a Terraform 1.12 and HCP Terraform environment. The team encounters the following situation: a root renames a managed resource label and Terraform proposes destroy and recreate even though the remote object is unchanged. Choose the technically best Terraform Associate 004 practice response to this particular infrastructure case. What mechanism explains why the original approach fails?
Explanation
Correct Answer
State tracks configuration addresses and a rename needs a migration mapping to preserve ownership. That mechanism distinguishes moved block for address refactor in the Frosthaven Health Research case. The corresponding appropriate correction is: Declare a moved block mapping old and new addresses when refactoring. The measurable acceptance test is: The plan reports an address move rather than destructive replacement.
Incorrect Answers
This alternative is valid when terraform compares real object attributes against state and declared desired configuration. The facts here establish a different controlling reason: State tracks configuration addresses and a rename needs a migration mapping to preserve ownership.
“Losing local state removes Terraform's stored association between addresses and remote objects” reflects the mechanism: Losing local state removes Terraform's stored association between addresses and remote objects. The actual reported symptoms are better explained by: State tracks configuration addresses and a rename needs a migration mapping to preserve ownership.
The offered principle describes: Resource type schemas are defined by the installed provider and must match configuration. The situation in this question instead depends on: State tracks configuration addresses and a rename needs a migration mapping to preserve ownership. These are different technical conditions.