- The OpenTofu Language
- Meta-Arguments
- lifecycle Blocks
lifecycle Blocks
Several different declaration types in the OpenTofu language support a nested
block named lifecycle which includes settings that customize the plan and
apply behavior of the associated object.
Each different type of declaration relates to objects that have a different lifecycle, and so the arguments available in these blocks are distinct for each parent block type:
resourceblock lifecycle, for managed resources.datablock lifecycle, for data resources.ephemeralblock lifecycle, for ephemeral resources.moduleblock lifecycle, for settings that relate to an overall module call instead of the individual resources inside it.
Although all of these features involve a block type named lifecycle, the
expected arguments and associated behavior is defined separately for each
context where a block of that type is allowed to appear.