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.
More on Dependencies, Cycles and Providers
`Error: Cycle: aws_security_group.app, aws_security_group.db`.Beginner`Error: Cycle: local.name_prefix, local.tags`.BeginnerA cycle appears only after adding `depends_on = [module.app]` to a module. The error lists dozens of nodes.Intermediate`terraform init` fails: `Could not retrieve the list of available versions for provider hashicorp/aws: no available releases match the given constraints ~> 4.0, >= 5.30.0`.Intermediate`Error: Inconsistent dependency lock file` with `locked version selection 5.31.0 doesn't match the updated version constraints ">= 5.40.0"`.Beginner`Error: Inconsistent dependency lock file` with `provider registry.terraform.io/hashicorp/random: required by this configuration but no version is selected`.Beginner