Interview Prep/Terraform/Dependencies, Cycles and Providers

Adding `create_before_destroy = true` to a launch template causes `Error: Cycle: ... (destroy deposed ...)`.

AdvancedTroubleshootingDependencies, Cycles and Providers
Answer

Likely causes → create_before_destroy propagates to dependencies: a resource it depends on doesn't have it, so Terraform must destroy the dependency before creating the new object and destroy the dependent first. The graph conflicts.

Diagnose → terraform graph -type=apply and look for (destroy deposed) nodes in the cycle.

Fix → Add create_before_destroy = true to the dependencies in the chain too (and use name_prefix so old and new can coexist).

Prevent → Design replaceable chains (LT → ASG → target group attachments) with consistent lifecycle settings from the start.

All Terraform questions Roadmap: Terraform

More on Dependencies, Cycles and Providers