Terraform lifecycle: replacement and protection
A lifecycle rule changes how Terraform handles a resource transition. Read it alongside the proposed action and the provider’s schema.
create_before_destroy asks Terraform to create the replacement before destroying the old object. That ordering can reduce an interruption, but it requires both objects to coexist and enough capacity for the overlap. A unique name or a constrained quota can prevent it.
prevent_destroy rejects a plan that would destroy the protected resource while the rule applies. Removing the resource block also removes its lifecycle configuration, so it is not a permanent protection against every code change. Organizational review and provider permissions remain separate controls.
ignore_changes can leave selected externally managed attributes out of update reconciliation. It doesn’t establish that the external owner made the right change. Document the owner and the attributes being delegated.
The official lifecycle reference explains the full rules. In this browser model, inspect replacement plans and dependency reasoning. The local provider cannot prove real object naming rules, quotas, availability or deployment timing.