The terraform_data Managed Resource Type
The terraform_data
implements the standard resource lifecycle, but does not directly take any other actions.
You can use the terraform_data
resource without requiring or configuring a provider. It is always available through a built-in provider with the source address terraform.io/builtin/terraform
.
The terraform_data
resource is useful for storing values which need to follow a manage resource lifecycle, and for triggering provisioners when there is no other logical managed resource in which to place them.
Example Usage (data for replace_triggered_by
)
The replace_triggered_by
lifecycle argument requires all of the given addresses to be for resources, because the decision to force replacement is based on the planned actions for all of the mentioned resources.
Plain data values such as Local Values and Input Variables don't have any side-effects to plan against and so they aren't valid in replace_triggered_by
. You can use terraform_data
's behavior of planning an action each time input
changes to indirectly use a plain value to trigger replacement.
Example Usage (null_resource
replacement)
Argument Reference
The following arguments are supported:
input
- (Optional) A value which will be stored in the instance state, and reflected in theoutput
attribute after apply.triggers_replace
- (Optional) A value which is stored in the instance state, and will force replacement when the value changes.
Attributes Reference
In addition to the above, the following attributes are exported: