lifecycle block controls how Pulumi manages a resource’s create, update, and delete operations. Supported on unit and component blocks.
Syntax
lifecycle block is allowed per resource.
Rules
prevent_destroy
Blocks pulumi destroy and ubx destroy from deleting the resource. Useful for production databases and critical infrastructure.
{ retainOnDelete: true }
ignore_changes
Tells Pulumi to ignore drift on specified attributes. The resource won’t be updated even if these attributes change outside of ubx.
{ ignoreChanges: ["password", "latestRestorableTime"] }
create_before_destroy
Creates the replacement resource before destroying the original. Minimises downtime during replacements.
{ deleteBeforeReplace: false }
All Three Combined
Constraints
- All lifecycle field values must be
Resolved<T>— no~pending references ignore_changestakes a list of attribute name strings- Only one
lifecycleblock per resource
