crossplane / terrajet

Generate Crossplane Providers from any Terraform Provider
https://crossplane.io
Apache License 2.0
289 stars 38 forks source link

Allow late-initialization before a Terraform apply #263

Closed ulucinar closed 2 years ago

ulucinar commented 2 years ago

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 the prevent_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:

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.