terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

container_cluster.node_config.kubelet_config.cpu_cfs_quota value is set in cluster request even when no value is set in config

Open hoskeri opened this issue 1 year ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

cloudtop:~$ terraform version Terraform v1.5.6 on linux_amd64

Affected Resource(s)

google_container_node_pool google_container_cluster

Terraform Configuration Files

resource "google_container_cluster" "primary" {
  name     = "some-cluster"
  location = "us-central1-a"
  initial_node_count       = 1
  node_config {
    kubelet_config {
      cpu_manager_policy = "none"
      pod_pids_limit = 8192
    }
  }
}


Debug Output

023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5: ---[ REQUEST ]---------------------------------------
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5: POST /v1/projects/hoskeri-gke-dev/locations/us-central1-a/clusters?alt=json&prettyPrint=false HTTP/1.1
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5: Host: container.googleapis.com
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5: User-Agent: google-api-go-client/0.5 Terraform/1.5.6 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google/4.81.0

...
023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:   "networkConfig": {},
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:   "networkPolicy": {},
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:   "nodeConfig": {
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:    "kubeletConfig": {
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:     "cpuCfsQuota": false,
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:     "cpuManagerPolicy": "none",
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:     "podPidsLimit": "8192"
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:    },
2023-09-07T20:43:49.384Z [DEBUG] provider.terraform-provider-google_v4.81.0_x5:    "loggingConfig": {

Panic Output

Expected Behavior

I would generally expect that any unset fields in configuration would not have a value in the cluster create request.

In this case, (refer to hcl above) cluster.node_config.kubelet_config.cpu_cfs_quota should not have resulted in that value not being set in the cluster create request, and resulting cluster should have had that value not set at all (set to null)

Actual Behavior

However, the value of cpu_cfs_quota is set by the provider to false in the cluster create request. The only way to avoid this outcome is to not set kubelet_config at all (or force cpu_cfs_quota to true.

Steps to Reproduce

  1. terraform apply

Important Factoids

b/300067081

hoskeri avatar Sep 07 '23 20:09 hoskeri