-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GKE node pool default for logging variant is not respected due to terraform's client-side defaulting of the logging_variant field #13706
Comments
@giuliano-sider I found below words under node_pool_defaults. Do you see a different behavior from what it says?
I noticed your below words.
Help me to understand where the bug is. If you propose a new behavior, maybe file an enhancement instead? |
To sum it up, the bug is that the google_container_cluster resource's I think my mistake in the implementation (see GoogleCloudPlatform/magic-modules#6744 and https://github.com/GoogleCloudPlatform/magic-modules/blob/f319c33c2aea0610c27a4cefb51f499ac91d8ce5/mmv1/third_party/terraform/utils/node_config.go.erb#L33) was to specify a Terraform default for this field. |
Documentation in https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/container_cluster#node_pool_defaults says:
but the value of |
@giuliano-sider I see what you mean. Since you are the original owner of that feature, assign this to you then. |
Terraform's not great at distinguishing between unset and default values. I'd agree with your initial assumption, @giuliano-sider, that this would be a breaking change to fix given the clientside default. This shouldn't be too hard to change in |
closed with GoogleCloudPlatform/magic-modules#8967 |
Reopening as I don't think removing the Terraform default of After removing the default, I tried the provided configuration. The nodepool POST request was sent with the following body:
This looks correct as we are no longer sending a field for logging variant. However, when the nodepool is created, the API does not return a value for logging variant, thus Terraform interprets it as @giuliano-sider are you able to confirm via the API that creating a nodepool while |
Updating the labels/milestone as the "breaking-change" portion is still going into 5.0.0. |
Community Note
Terraform Version
v4.44.0 is the first google terraform provider version to carry the logging_variant field
Affected Resource(s)
Terraform Configuration Files (if applicable)
Consider the following experiment:
The terraform plan for the above resources shows that
node_config.logging_variant
is defaulted with a value of DEFAULT when any other field in the node_config (e.g. machine_type) is specified: https://gist.github.com/giuliano-sider/2064705c25f608f55f8b1a4377996ed3. This is undesirable because the cluster resource specifies a default value in itsnode_pool_defaults.node_config_defaults
that ought to be respected.Issue Description
The
google_container_cluster
resource'snode_pool_defaults.node_config_defaults.logging_variant
field mirrors an existing field in the GKE API (https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#Cluster.NodePoolDefaults) that provides a default value for the logging variant to use in the creation of new node pools in that cluster. However, in certain cases, this google_container_cluster field is not being respected because terraform provides a client-side default value for thenode_config.logging_variant
field ofgoogle_container_node_pool
(see https://github.com/GoogleCloudPlatform/magic-modules/blob/f319c33c2aea0610c27a4cefb51f499ac91d8ce5/mmv1/third_party/terraform/utils/node_config.go.erb#L33). When this client-side defaulting doesn't happen, then the default fromnode_pool_defaults.node_config_defaults.logging_variant
is respected. See the terraform config and its terraform plan from the previous section for an example of when this doesn't work as intended (i.e. when any other field innode_config
is set, the terraform client will apply a default ofDEFAULT
for the logging_variant field).In practice, this bug makes the
node_pool_defaults.node_config_defaults.logging_variant
unusable, because one should always set anode_config.machine_type
with enough CPU for a node pool that has aMAX_THROUGHPUT
logging_variant. With this bug in place, customers should refrain from usingnode_pool_defaults.node_config_defaults.logging_variant
and instead always specify thenode_config.logging_variant
they want in the google_container_node_pool.Would it be possible to fix this? Would we remove this default from https://github.com/GoogleCloudPlatform/magic-modules/blob/f319c33c2aea0610c27a4cefb51f499ac91d8ce5/mmv1/third_party/terraform/utils/node_config.go.erb#L33 ? Or would this be considered backward incompatible? Note that if nothing is specified for logging_variant in either the node pool defaults or in the node pool, the server will default the logging variant of the node pool to DEFAULT (but maybe not explicitly).
Important Factoids
References
The text was updated successfully, but these errors were encountered: