As the generation template defaults to using the GenericLateInitializer I don't see a way to have a custom late init function for a specific resource.
A configurable custom late init function per resource would be helpful to solve an issue I believe.
This custom function should be able to handle the following use cases:
Have access to the forProvider fields to use as decision input which parameters from the terraform state to ignore
Use a wildcard glob or regex to match terraform state parameters to exclude
Scenario 1:
forProvider:
gkeConfigV2:
- imported: true
This imported=true use case requires only a specific few attributes to be set, the terraform state on the other hand returns more computed attributes. These computed attributes should be ignored during a tf plan/apply, otherwise they conflict with the imported=true attribute.
Terraform state return additional annotations and labels, but these are externally managed (imported=true). These labels/annotations should be excluded from tf plan/apply and resource drift detection. Crossplane should not be trying to 'revert' the values of these labels/annotations to the value it got after the create/initial apply.
For example, Rancher adds annotations for its own internal housekeeping with a timestamp value:
When Rancher refreshes, and updates the value of this annotation, Crossplane triggers resource drift and tries to revert the value, which is obviously not what should be happening.
Currently late initialization is configured with
As the generation template defaults to using the
GenericLateInitializer
I don't see a way to have a custom late init function for a specific resource.A configurable custom late init function per resource would be helpful to solve an issue I believe. This custom function should be able to handle the following use cases:
forProvider
fields to use as decision input which parameters from the terraform state to ignoreScenario 1:
This
imported=true
use case requires only a specific few attributes to be set, the terraform state on the other hand returns more computed attributes. These computed attributes should be ignored during a tf plan/apply, otherwise they conflict with theimported=true
attribute.Scenario 2:
Terraform state return additional annotations and labels, but these are externally managed (
imported=true
). These labels/annotations should be excluded from tf plan/apply and resource drift detection. Crossplane should not be trying to 'revert' the values of these labels/annotations to the value it got after the create/initial apply.For example, Rancher adds annotations for its own internal housekeeping with a timestamp value:
When Rancher refreshes, and updates the value of this annotation, Crossplane triggers resource drift and tries to revert the value, which is obviously not what should be happening.