A scenario, where terraform apply
results in delete of the existing resource, is it possible to know whether this delete is part of the terraform apply
or destroy
?
No. In the general sense destroy
is equivalent to removing all managed resources from the config and then running apply
. Note that the more procedural way to destroy is to use terraform plan -destroy
and apply the resulting plan, which makes it a bit more apparent that they are intended to be treated equivalently.
No, I’m asking regarding the development of a provider. I have a custom provider, where some resources get destroyed as part of #forced replacement, if there is a update on any force new attributes
Wanted to know if there is a way to know from the resource data that this is a destroy or apply.
The answer is still the same from the perspective of the provider, ApplyResourceChange
is called the same way in both cases.