Question 390
The reliability team at Bayview Systems is closing an incident described as follows: A for_each expression needs stable, unique resource keys but receives a list of objects without a keyed identity. Which observation best confirms that the proposed correction worked?
Explanation
Correct Answer
Reordering the source objects produces no spurious address changes in the resulting plan. This directly verifies the corrective action: Transform the collection into a map keyed by a stable unique identifier before using for_each. The measured result specifically addresses the failure at Bayview Systems: A for_each expression needs stable, unique resource keys but receives a list of objects without a keyed identity.
Incorrect Answers
A noninteractive run resolves the expected values without unexpected prompts. This evidence would validate a DIFFERENT correction: Use declared defaults and supported explicit variable assignment mechanisms with documented precedence. That different correction addresses: An operator expects every variable to require a prompt even though some have defaults and others are set through tfvars or environment. It does not establish that the Bayview Systems issue has been corrected: A for_each expression needs stable, unique resource keys but receives a list of objects without a keyed identity. The relevant measured outcome is: Reordering the source objects produces no spurious address changes in the resulting plan.
A new environment consumes the same reviewed module version and passes its resource and tag checks. This evidence would validate a DIFFERENT correction: Adopt reusable Terraform module patterns and enforce review of their inputs and versions. That different correction addresses: An operations group writes bespoke scripts for each environment and struggles to share tested infrastructure patterns. It does not establish that the Bayview Systems issue has been corrected: A for_each expression needs stable, unique resource keys but receives a list of objects without a keyed identity. The relevant measured outcome is: Reordering the source objects produces no spurious address changes in the resulting plan.
A simulated pair of runs does not perform simultaneous unsafe state writes. This evidence would validate a DIFFERENT correction: Verify the selected backend's documented locking support and add an execution serialization control if necessary. That different correction addresses: A repository uses a remote backend that does not implement locking, but a team claims every remote backend automatically prevents concurrent applies. It does not establish that the Bayview Systems issue has been corrected: A for_each expression needs stable, unique resource keys but receives a list of objects without a keyed identity. The relevant measured outcome is: Reordering the source objects produces no spurious address changes in the resulting plan.