Question 640
At Thornvale Logistics Networks, an authorized infrastructure engineering team manages a Terraform 1.12 and HCP Terraform environment. The team encounters the following situation: a private certificate must be replaced whenever an associated versioned key resource changes even though the certificate configuration itself is unchanged. Choose the technically best Terraform Associate 004 practice response to this particular infrastructure case. Which operational control addresses the risk long term?
Explanation
Correct Answer
Test lifecycle triggers and their downstream impacts before use. This control addresses replace_triggered_by dependency because a lifecycle replacement trigger can coordinate recreation when another tracked resource changes. The original implementation remedy remains: Use supported lifecycle replace_triggered_by with a relevant managed resource dependency.
Incorrect Answers
“Use explicit dependencies only for real hidden ordering requirements” addresses a different recurring failure: Terraform cannot infer dependencies that are not expressed in resource references. For the condition in this question, maintain “Test lifecycle triggers and their downstream impacts before use” because a lifecycle replacement trigger can coordinate recreation when another tracked resource changes.
That review protects the control associated with: A resource block manages lifecycle while a data block queries external information. It does not directly prevent the stated recurrence, which concerns: A lifecycle replacement trigger can coordinate recreation when another tracked resource changes. The appropriate guardrail is “Test lifecycle triggers and their downstream impacts before use”.
This safeguard is for the dependency described by: Without an appropriate constraint init can select a provider release incompatible with existing resource declarations. The continuing risk here is determined by: A lifecycle replacement trigger can coordinate recreation when another tracked resource changes. The targeted safeguard is “Test lifecycle triggers and their downstream impacts before use”.