You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Currently in Terrajet, we generate fields that correspond to Terraform attributes with a required schema such as this one with non-pointer types. When we late initialize an instance of the enclosing type (network_profile in this example) with an optional schema, we only late-initialize the optional, hence pointer-typed fields) but not the fields that are marked as required. This is because the late-initialization library only initializes nil-pointers because zero-values of non-pointer types (e.g., an empty string) could be a valid value for that attribute, which should not be late-initialized.
How can we reproduce it?
When trying #77 with provider-tf-azure on a v1alpha1.KubernetesCluster resource, first the Kubernetes cluster is provisioned successfully but after the first observation causes a NetworkPlugin to be late-initialized without the NetworkPlugin field (a required field) being late-initialized to one of the allowed values (kubenet or azure) although the Terraform state has it properly set to kubenet.
The text was updated successfully, but these errors were encountered:
After discussing this issue with @muvaf, we have decided to generate required fields with pointer types also. This will have a bigger impact when compared to handling the situation per-case via Terraformed resource configurations but we do not expect any new issues when we switch from non-pointer to pointer types for required fields and if we succeed, it will provide a better development experience without the need for custom configurations. Also we cannot detect such issues at build time and if we don't attempt to address by non-pointer types, we will be hunting for these issues at runtime.
What happened?
Currently in Terrajet, we generate fields that correspond to Terraform attributes with a required schema such as this one with non-pointer types. When we late initialize an instance of the enclosing type (
network_profile
in this example) with an optional schema, we only late-initialize the optional, hence pointer-typed fields) but not the fields that are marked as required. This is because the late-initialization library only initializes nil-pointers because zero-values of non-pointer types (e.g., an empty string) could be a valid value for that attribute, which should not be late-initialized.How can we reproduce it?
When trying #77 with
provider-tf-azure
on a v1alpha1.KubernetesCluster resource, first the Kubernetes cluster is provisioned successfully but after the first observation causes aNetworkPlugin
to be late-initialized without theNetworkPlugin
field (a required field) being late-initialized to one of the allowed values (kubenet
orazure
) although the Terraform state has it properly set tokubenet
.The text was updated successfully, but these errors were encountered: