Skip to content

Commit cf7de80

Browse files
shuyama1abd-goog
authored andcommitted
Do not force send insecure_kubelet_readonly_port_enabled during creation (GoogleCloudPlatform#11688)
1 parent 70e1ce7 commit cf7de80

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

mmv1/third_party/terraform/services/container/node_config.go.erb

-1
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,6 @@ func expandNodeConfigDefaults(configured interface{}) *container.NodeConfigDefau
836836
if v, ok := config["insecure_kubelet_readonly_port_enabled"]; ok {
837837
nodeConfigDefaults.NodeKubeletConfig = &container.NodeKubeletConfig{
838838
InsecureKubeletReadonlyPortEnabled: expandInsecureKubeletReadonlyPortEnabled(v),
839-
ForceSendFields: []string{"InsecureKubeletReadonlyPortEnabled"},
840839
}
841840
}
842841
if variant, ok := config["logging_variant"]; ok {

mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.erb

+45
Original file line numberDiff line numberDiff line change
@@ -3370,6 +3370,32 @@ func TestAccContainerCluster_withAutopilotKubeletConfig(t *testing.T) {
33703370
})
33713371
}
33723372

3373+
func TestAccContainerCluster_withAutopilot_withNodePoolDefaults(t *testing.T) {
3374+
t.Parallel()
3375+
3376+
randomSuffix := acctest.RandString(t, 10)
3377+
clusterName := fmt.Sprintf("tf-test-cluster-%s", randomSuffix)
3378+
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
3379+
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
3380+
3381+
acctest.VcrTest(t, resource.TestCase{
3382+
PreCheck: func() { acctest.AccTestPreCheck(t) },
3383+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
3384+
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
3385+
Steps: []resource.TestStep{
3386+
{
3387+
Config: testAccContainerCluster_withAutopilot_withNodePoolDefaults(clusterName, networkName, subnetworkName),
3388+
},
3389+
{
3390+
ResourceName: "google_container_cluster.primary",
3391+
ImportState: true,
3392+
ImportStateVerify: true,
3393+
ImportStateVerifyIgnore: []string{"deletion_protection"},
3394+
},
3395+
},
3396+
})
3397+
}
3398+
33733399

33743400
func TestAccContainerCluster_withAutopilotResourceManagerTags(t *testing.T) {
33753401
t.Parallel()
@@ -10710,6 +10736,25 @@ func testAccContainerCluster_withAutopilotKubeletConfigUpdates(name, insecureKub
1071010736
`, name, insecureKubeletReadonlyPortEnabled)
1071110737
}
1071210738

10739+
func testAccContainerCluster_withAutopilot_withNodePoolDefaults(name, networkName, subnetworkName string) string {
10740+
return fmt.Sprintf(`
10741+
resource "google_container_cluster" "primary" {
10742+
name = "%s"
10743+
location = "us-central1"
10744+
enable_autopilot = true
10745+
10746+
node_pool_defaults {
10747+
node_config_defaults {
10748+
}
10749+
}
10750+
10751+
deletion_protection = false
10752+
network = "%s"
10753+
subnetwork = "%s"
10754+
}
10755+
`, name, networkName, subnetworkName)
10756+
}
10757+
1071310758
func testAccContainerCluster_resourceManagerTags(projectID, clusterName, networkName, subnetworkName, randomSuffix string) string {
1071410759
return fmt.Sprintf(`
1071510760
data "google_project" "project" {

0 commit comments

Comments
 (0)