Due to an optimization related with the readiness of Terraformed resources, in certain circumstances, we never have a chance to do a late initialization before we run a Terraform apply. However, as revealed in https://github.com/crossplane-contrib/provider-jet-azure/issues/139, for certain resources and their configurations, it helps to do an early late-initialize before a Terraform plan. If certain optional fields are not set, a Terraform plan fails because we use the prevent_destroy lifecycle meta-argument.
Description of your changes
Due to an optimization related with the readiness of
Terraformed
resources, in certain circumstances, we never have a chance to do a late initialization before we run a Terraform apply. However, as revealed in https://github.com/crossplane-contrib/provider-jet-azure/issues/139, for certain resources and their configurations, it helps to do an early late-initialize before a Terraform plan. If certain optional fields are not set, a Terraform plan fails because we use theprevent_destroy
lifecycle meta-argument.Categorically, we can also claim that these are upstream Terraform issues (e.g., one is here) but with this PR, we can both solve such cases and also preserve the readiness optimization we already have. For some context, please refer to https://github.com/crossplane-contrib/provider-jet-azure/issues/139 and please also see https://github.com/crossplane-contrib/provider-jet-azure/issues/139#issuecomment-1067630912.
I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Tested via consuming this PR in
provider-jet-azure
in the context of https://github.com/crossplane-contrib/provider-jet-azure/issues/139.