From 28954b1ad496b9c858ef4f1ae805539980d77c7a Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Tue, 8 Sep 2026 16:19:22 -0700 Subject: [PATCH 1/7] container: sweep regional clusters and add age filter in sweeper --- .../resource_container_cluster_sweeper.go | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go b/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go index 44d40044ad60..b78669701c4e 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "time" "github.com/hashicorp/terraform-provider-google/google/sweeper" ) @@ -23,8 +24,9 @@ func testSweepContainerClusters(region string) error { log.Fatalf("error loading: %s", err) } - // List clusters for all zones by using "-" as the zone name - found, err := NewClient(config, config.UserAgent).Projects.Zones.Clusters.List(config.Project, "-").Do() + // List clusters for all locations by using "-" as the location name + parent := fmt.Sprintf("projects/%s/locations/-", config.Project) + found, err := NewClient(config, config.UserAgent).Projects.Locations.Clusters.List(parent).Do() if err != nil { log.Printf("error listing container clusters: %s", err) return nil @@ -36,16 +38,34 @@ func testSweepContainerClusters(region string) error { } for _, cluster := range found.Clusters { - if sweeper.IsSweepableTestResource(cluster.Name) { - log.Printf("Sweeping Container Cluster: %s", cluster.Name) - clusterURL := fmt.Sprintf("projects/%s/locations/%s/clusters/%s", config.Project, cluster.Location, cluster.Name) - _, err := NewClient(config, config.UserAgent).Projects.Locations.Clusters.Delete(clusterURL).Do() + if !sweeper.IsSweepableTestResource(cluster.Name) { + continue + } + if cluster.CreateTime != "" { + createdAt, err := time.Parse(time.RFC3339Nano, cluster.CreateTime) if err != nil { - log.Printf("Error, failed to delete cluster %s: %s", cluster.Name, err) - return nil + createdAt, err = time.Parse(time.RFC3339, cluster.CreateTime) + } + if err == nil && time.Since(createdAt) < 2*time.Hour { + log.Printf("Skipping cluster %s, created recently (%s)", cluster.Name, time.Since(createdAt)) + continue } } + + if cluster.Status == "PROVISIONING" || cluster.Status == "RECONCILING" || cluster.Status == "STOPPING" { + log.Printf("Skipping cluster %s in non-deletable status %s", cluster.Name, cluster.Status) + continue + } + + log.Printf("Sweeping Container Cluster: %s", cluster.Name) + clusterURL := fmt.Sprintf("projects/%s/locations/%s/clusters/%s", config.Project, cluster.Location, cluster.Name) + _, err := NewClient(config, config.UserAgent).Projects.Locations.Clusters.Delete(clusterURL).Do() + + if err != nil { + log.Printf("Error, failed to delete cluster %s: %s", cluster.Name, err) + return nil + } } return nil From 0d959aebd51b92641617197544d5e1559c790764 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Tue, 8 Sep 2026 16:22:36 -0700 Subject: [PATCH 2/7] container: use e2-micro for tests without specific size and removed default pools --- .../resource_container_cluster_test.go.tmpl | 52 ++++++++++++++++--- .../resource_container_node_pool_test.go.tmpl | 31 ++++++++++- 2 files changed, 73 insertions(+), 10 deletions(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index 26fee76e9042..8d619c092bac 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -5020,6 +5020,9 @@ resource "google_container_cluster" "primary" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } network = "%s" subnetwork = "%s" deletion_protection = false @@ -8398,6 +8401,9 @@ resource "google_container_cluster" "primary" { initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } node_locations = [ "us-central1-b", @@ -8438,6 +8444,9 @@ resource "google_container_cluster" "primary" { initial_node_count = 1 remove_default_node_pool = true # Not worth updating + node_config { + machine_type = "e2-micro" + } node_locations = [ "us-central1-f", @@ -8941,7 +8950,7 @@ resource "google_container_cluster" "confidential_nodes" { name = "%s" initial_node_count = 1 node_config { - machine_type = "e2-medium" + machine_type = "e2-micro" } } @@ -8968,7 +8977,7 @@ resource "google_container_cluster" "confidential_nodes" { name = "%s" initial_node_count = 1 node_config { - machine_type = "e2-medium" + machine_type = "e2-micro" } } @@ -8995,7 +9004,7 @@ resource "google_container_cluster" "confidential_nodes" { name = "%s" initial_node_count = 1 node_config { - machine_type = "e2-medium" + machine_type = "e2-micro" } } @@ -9021,7 +9030,7 @@ resource "google_container_cluster" "confidential_nodes" { name = "%s" initial_node_count = 1 node_config { - machine_type = "e2-medium" + machine_type = "e2-micro" } } @@ -9049,7 +9058,7 @@ resource "google_container_cluster" "confidential_nodes" { name = "%s" initial_node_count = 1 node_config { - machine_type = "e2-medium" + machine_type = "e2-micro" } } @@ -9071,6 +9080,9 @@ resource "google_container_cluster" "with_network_policy_enabled" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } network_policy { enabled = true @@ -9187,6 +9199,9 @@ resource "google_container_cluster" "with_network_policy_enabled" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } network = "%s" subnetwork = "%s" @@ -9203,6 +9218,9 @@ resource "google_container_cluster" "with_network_policy_enabled" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } network_policy { enabled = false @@ -9222,6 +9240,9 @@ resource "google_container_cluster" "with_network_policy_enabled" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } network_policy { enabled = false @@ -10420,7 +10441,7 @@ resource "google_container_cluster" "with_node_config_scope_alias" { initial_node_count = 1 node_config { - machine_type = "e2-medium" + machine_type = "e2-micro" disk_size_gb = 15 oauth_scopes = ["compute-rw", "storage-ro", "logging-write", "monitoring"] } @@ -10440,7 +10461,7 @@ resource "google_container_cluster" "with_node_config" { initial_node_count = 1 node_config { - machine_type = "e2-medium" + machine_type = "e2-micro" disk_size_gb = 15 disk_type = "pd-ssd" oauth_scopes = [ @@ -12750,6 +12771,9 @@ resource "google_container_cluster" "with_workload_identity_config" { workload_pool = "${data.google_project.project.project_id}.svc.id.goog" } remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } network = "%s" subnetwork = "%s" @@ -12806,6 +12830,9 @@ resource "google_container_cluster" "with_workload_identity_config" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } %s network = "%s" @@ -13152,6 +13179,9 @@ resource "google_container_cluster" "with_mesh_certificates_config" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } workload_identity_config { workload_pool = "${data.google_project.project.project_id}.svc.id.goog" } @@ -13177,6 +13207,9 @@ resource "google_container_cluster" "with_mesh_certificates_config" { location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } workload_identity_config { workload_pool = "${data.google_project.project.project_id}.svc.id.goog" } @@ -19403,6 +19436,9 @@ resource "google_container_cluster" "primary" { # We must delete the default node pool to ensure we only have our standalone node pool remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } skip_node_pool_refresh = %t } @@ -19415,7 +19451,7 @@ resource "google_container_node_pool" "extra" { node_config { preemptible = true - machine_type = "e2-medium" + machine_type = "e2-micro" } } `, suffix, suffix, clusterName, skipRefresh, poolName) diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl index c8f8c91d59cc..45ad4189b22d 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl @@ -3787,7 +3787,7 @@ resource "google_container_node_pool" "np_with_management" { %s node_config { - machine_type = "g1-small" + machine_type = "e2-micro" disk_size_gb = 15 oauth_scopes = ["compute-rw", "storage-ro", "logging-write", "monitoring"] } @@ -5020,6 +5020,9 @@ resource "google_container_cluster" "cluster" { initial_node_count = 1 remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } } resource "google_container_node_pool" "np_with_gpudirect" { @@ -5439,6 +5442,9 @@ resource "google_container_cluster" "cluster" { initial_node_count = 1 # Testing the node pool update, so don't need default-pool also. remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"] network = "%s" subnetwork = "%s" @@ -5478,6 +5484,9 @@ resource "google_container_cluster" "cluster" { initial_node_count = 1 # Testing the node pool update, so don't need default-pool also. remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"] network = "%s" subnetwork = "%s" @@ -6289,6 +6298,9 @@ resource "google_container_cluster" "primary" { # node pool and immediately delete it. remove_default_node_pool = true initial_node_count = 1 + node_config { + machine_type = "e2-micro" + } deletion_protection = false network = "%{network}" @@ -6305,6 +6317,7 @@ resource "google_container_node_pool" "primary_nodes" { node_count = 1 node_config { + machine_type = "e2-micro" disk_size_gb = 15 resource_manager_tags = { @@ -6335,6 +6348,9 @@ resource "google_container_cluster" "primary" { # node pool and immediately delete it. remove_default_node_pool = true initial_node_count = 1 + node_config { + machine_type = "e2-micro" + } deletion_protection = false network = "%{network}" @@ -6351,6 +6367,7 @@ resource "google_container_node_pool" "primary_nodes" { node_count = 1 node_config { + machine_type = "e2-micro" disk_size_gb = 15 resource_manager_tags = { @@ -6382,6 +6399,9 @@ resource "google_container_cluster" "primary" { # node pool and immediately delete it. remove_default_node_pool = true initial_node_count = 1 + node_config { + machine_type = "e2-micro" + } deletion_protection = false network = "%{network}" @@ -6398,6 +6418,7 @@ resource "google_container_node_pool" "primary_nodes" { node_count = 1 node_config { + machine_type = "e2-micro" disk_size_gb = 15 } } @@ -7013,6 +7034,9 @@ resource "google_container_cluster" "primary" { remove_default_node_pool = true initial_node_count = 1 + node_config { + machine_type = "e2-micro" + } datapath_provider = "ADVANCED_DATAPATH" ip_allocation_policy {} @@ -7485,6 +7509,9 @@ resource "google_container_cluster" "cluster" { } remove_default_node_pool = true + node_config { + machine_type = "e2-micro" + } } resource "google_container_node_pool" "np" { @@ -7496,7 +7523,7 @@ resource "google_container_node_pool" "np" { node_config { preemptible = true - machine_type = "e2-medium" + machine_type = "e2-micro" } } `, suffix, suffix, clusterName, poolName, count, ignoreChanges) From b6e444594d8f69aae3df73ff24f331e8d62fcb00 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Tue, 8 Sep 2026 16:26:35 -0700 Subject: [PATCH 3/7] container: set test node count to 1 where safe --- .../resource_container_cluster_test.go.tmpl | 32 +++---- .../resource_container_node_pool_test.go.tmpl | 90 +++++++++---------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index 8d619c092bac..147d68b77a6c 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -8237,7 +8237,7 @@ func testAccContainerCluster_network_tier_config(clusterName, networkName, subne resource "google_container_cluster" "primary" { name = "%s" location = "us-central1-a" - initial_node_count = 2 + initial_node_count = 1 dns_config { cluster_dns = "CLOUD_DNS" } @@ -8260,7 +8260,7 @@ func testAccContainerCluster_network_tier_config_none(clusterName, networkName, resource "google_container_cluster" "primary" { name = "%s" location = "us-central1-a" - initial_node_count = 2 + initial_node_count = 1 dns_config { cluster_dns = "CLOUD_DNS" } @@ -8663,7 +8663,7 @@ resource "google_pubsub_topic" "%s" { resource "google_container_cluster" "notification_config" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 notification_config { pubsub { enabled = true @@ -8683,7 +8683,7 @@ func testAccContainerCluster_disableNotificationConfig(clusterName, networkName, resource "google_container_cluster" "notification_config" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 notification_config { pubsub { enabled = false @@ -8708,7 +8708,7 @@ resource "google_pubsub_topic" "%s" { resource "google_container_cluster" "filtered_notification_config" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 notification_config { pubsub { enabled = true @@ -8737,7 +8737,7 @@ resource "google_pubsub_topic" "%s" { resource "google_container_cluster" "filtered_notification_config" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 notification_config { pubsub { enabled = true @@ -8765,7 +8765,7 @@ resource "google_pubsub_topic" "%s" { resource "google_container_cluster" "filtered_notification_config" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 notification_config { pubsub { enabled = true @@ -9832,7 +9832,7 @@ func testAccContainerCluster_withMasterAuthNoCert(clusterName, networkName, subn resource "google_container_cluster" "with_master_auth_no_cert" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 master_auth { client_certificate_config { issue_client_certificate = false @@ -11076,7 +11076,7 @@ resource "google_compute_http_health_check" "default" { resource "google_container_cluster" "primary" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 node_locations = [ "us-central1-b", @@ -11107,7 +11107,7 @@ resource "google_container_cluster" "with_node_pool" { node_pool { name = "%s" - initial_node_count = 2 + initial_node_count = 1 } network = "%s" @@ -11132,7 +11132,7 @@ resource "google_container_cluster" "with_node_pool" { node_pool { name = "%s" - initial_node_count = 2 + initial_node_count = 1 version = data.google_container_engine_versions.central1a.valid_node_versions[2] } network = "%s" @@ -11157,7 +11157,7 @@ resource "google_container_cluster" "with_node_pool" { node_pool { name = "%s" - initial_node_count = 2 + initial_node_count = 1 version = data.google_container_engine_versions.central1a.valid_node_versions[1] } network = "%s" @@ -11761,7 +11761,7 @@ resource "google_container_cluster" "with_node_pool" { node_pool { name = "%s" - initial_node_count = 2 + initial_node_count = 1 } network = "%s" subnetwork = "%s" @@ -13027,7 +13027,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { resource "google_container_cluster" "with_flexible_cidr" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 networking_mode = "VPC_NATIVE" network = google_compute_network.container_network.name @@ -18350,7 +18350,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -18378,7 +18378,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl index 45ad4189b22d..02ea21682d32 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl @@ -500,7 +500,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -511,7 +511,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 3 + initial_node_count = 1 node_config { machine_type = "c3-standard-4" @@ -536,7 +536,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -547,7 +547,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 3 + initial_node_count = 1 node_config { machine_type = "c3-standard-4" @@ -573,7 +573,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -584,7 +584,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 3 + initial_node_count = 1 node_config { machine_type = "c3-standard-4" @@ -608,7 +608,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -619,7 +619,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 3 + initial_node_count = 1 node_config { machine_type = "c3-standard-4" @@ -641,7 +641,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -652,7 +652,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 3 + initial_node_count = 1 node_config { machine_type = "c3-standard-4" @@ -3319,7 +3319,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3330,7 +3330,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 } `, cluster, networkName, subnetworkName, np) } @@ -3368,7 +3368,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3378,7 +3378,7 @@ resource "google_container_node_pool" "np" { provider = google.user-project-override name = "%s" cluster = google_container_cluster.cluster.id - initial_node_count = 2 + initial_node_count = 1 } `, cluster, networkName, subnetworkName, np) } @@ -3470,7 +3470,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 network = google_compute_network.container_network.name subnetwork = google_compute_subnetwork.container_subnetwork.name @@ -3495,7 +3495,7 @@ resource "google_container_node_pool" "np" { location = "us-central1-a" cluster = google_container_cluster.cluster.name max_pods_per_node = 30 - initial_node_count = 2 + initial_node_count = 1 } `, network, cluster, np) } @@ -3505,7 +3505,7 @@ func testAccContainerNodePool_regionalClusters(cluster, np, networkName, subnetw resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3515,7 +3515,7 @@ resource "google_container_node_pool" "np" { name = "%s" cluster = google_container_cluster.cluster.name location = "us-central1" - initial_node_count = 2 + initial_node_count = 1 } `, cluster, networkName, subnetworkName, np) } @@ -3525,7 +3525,7 @@ func testAccContainerNodePool_namePrefix(cluster, np, networkName, subnetworkNam resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3535,7 +3535,7 @@ resource "google_container_node_pool" "np" { name_prefix = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 } `, cluster, networkName, subnetworkName, np) } @@ -3545,7 +3545,7 @@ func testAccContainerNodePool_noName(cluster, networkName, subnetworkName string resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3554,7 +3554,7 @@ resource "google_container_cluster" "cluster" { resource "google_container_node_pool" "np" { location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 } `, cluster, networkName, subnetworkName) } @@ -3564,7 +3564,7 @@ func testAccContainerNodePool_regionalAutoscaling(cluster, np, networkName, subn resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3588,7 +3588,7 @@ func testAccContainerNodePool_totalSize(cluster, np, networkName, subnetworkName resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1" - initial_node_count = 3 + initial_node_count = 1 network = "%s" subnetwork = "%s" @@ -3615,7 +3615,7 @@ func testAccContainerNodePool_updateTotalSize(cluster, np, networkName, subnetwo resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1" - initial_node_count = 3 + initial_node_count = 1 network = "%s" subnetwork = "%s" @@ -3652,7 +3652,7 @@ resource "google_container_cluster" "cluster" { network = "%s" subnetwork = "%s" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false } @@ -3661,7 +3661,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 } `, cluster, networkName, subnetworkName, np) } @@ -3671,7 +3671,7 @@ func testAccContainerNodePool_autoscaling(cluster, np, networkName, subnetworkNa resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3695,7 +3695,7 @@ func testAccContainerNodePool_updateAutoscaling(cluster, np, networkName, subnet resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3921,7 +3921,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3932,7 +3932,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 node_config { taint { @@ -3957,7 +3957,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -3968,7 +3968,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 node_config { machine_type = "n1-standard-1" // can't be e2 because of local-ssd @@ -5310,7 +5310,7 @@ func testAccContainerNodePool_EmptyGuestAccelerator(cluster, np, networkName, su resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-f" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -5338,7 +5338,7 @@ func testAccContainerNodePool_PartialEmptyGuestAccelerator(cluster, np, networkN resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-f" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -5371,7 +5371,7 @@ func testAccContainerNodePool_PartialEmptyGuestAccelerator2(cluster, np, network resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-f" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%s" subnetwork = "%s" @@ -5419,7 +5419,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 node_config { shielded_instance_config { enable_integrity_monitoring = true @@ -5456,7 +5456,7 @@ resource "google_container_node_pool" "np1" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 # Note: without version specified, this will likely get an older version than # the control plane, which helps when we then update in the next step. } @@ -5465,7 +5465,7 @@ resource "google_container_node_pool" "np2" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 # Note: without version specified, this will likely get an older version than # the control plane, which helps when we then update in the next step. } @@ -5498,7 +5498,7 @@ resource "google_container_node_pool" "np1" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 # Force an update by going to a different, but still compatible version. version = data.google_container_engine_versions.uscentral1a.release_channel_default_version["STABLE"] # The node version must remain within one minor version of the cluster @@ -5512,7 +5512,7 @@ resource "google_container_node_pool" "np2" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 version = data.google_container_engine_versions.uscentral1a.release_channel_default_version["STABLE"] # The node version must remain within one minor version of the cluster # control-plane version, and it must not exceed the control-planeversion @@ -6856,7 +6856,7 @@ data "google_container_engine_versions" "central1a" { resource "google_container_cluster" "cluster" { name = "%s" location = "us-central1-a" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false min_master_version = data.google_container_engine_versions.central1a.release_channel_latest_version["RAPID"] @@ -6871,7 +6871,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 node_config { service_account = "default" @@ -7003,7 +7003,7 @@ resource "google_container_cluster" "cluster" { provider = google.user-project-override name = "%[1]s" location = "%[6]s" - initial_node_count = 3 + initial_node_count = 1 deletion_protection = false network = "%[3]s" subnetwork = "%[4]s" @@ -7014,7 +7014,7 @@ resource "google_container_node_pool" "np" { name = "%[1]s" location = "%[6]s" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 node_config { machine_type = "c3-standard-4" From 5d5933b692fe7ab443ed030ec23566af106f0139 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Sat, 12 Sep 2026 10:04:54 -0700 Subject: [PATCH 4/7] test fixes --- .../resource_container_cluster_test.go.tmpl | 44 +++++++++++++++++++ .../resource_container_node_pool_test.go.tmpl | 34 +++++++++++++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index 147d68b77a6c..16aa40f97019 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -5023,6 +5023,9 @@ resource "google_container_cluster" "primary" { node_config { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } network = "%s" subnetwork = "%s" deletion_protection = false @@ -8405,6 +8408,10 @@ resource "google_container_cluster" "primary" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + node_locations = [ "us-central1-b", "us-central1-c", @@ -8448,6 +8455,10 @@ resource "google_container_cluster" "primary" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + node_locations = [ "us-central1-f", "us-central1-c", @@ -9084,6 +9095,10 @@ resource "google_container_cluster" "with_network_policy_enabled" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + network_policy { enabled = true provider = "CALICO" @@ -9203,6 +9218,10 @@ resource "google_container_cluster" "with_network_policy_enabled" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + network = "%s" subnetwork = "%s" @@ -9222,6 +9241,10 @@ resource "google_container_cluster" "with_network_policy_enabled" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + network_policy { enabled = false } @@ -9244,6 +9267,10 @@ resource "google_container_cluster" "with_network_policy_enabled" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + network_policy { enabled = false } @@ -12775,6 +12802,10 @@ resource "google_container_cluster" "with_workload_identity_config" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + network = "%s" subnetwork = "%s" @@ -12833,6 +12864,9 @@ resource "google_container_cluster" "with_workload_identity_config" { node_config { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } %s network = "%s" @@ -13182,6 +13216,9 @@ resource "google_container_cluster" "with_mesh_certificates_config" { node_config { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } workload_identity_config { workload_pool = "${data.google_project.project.project_id}.svc.id.goog" } @@ -13210,6 +13247,9 @@ resource "google_container_cluster" "with_mesh_certificates_config" { node_config { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } workload_identity_config { workload_pool = "${data.google_project.project.project_id}.svc.id.goog" } @@ -19440,6 +19480,10 @@ resource "google_container_cluster" "primary" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + skip_node_pool_refresh = %t } diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl index 02ea21682d32..29d15058facd 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl @@ -5023,6 +5023,10 @@ resource "google_container_cluster" "cluster" { node_config { machine_type = "e2-micro" } + + lifecycle { + ignore_changes = [node_config] + } } resource "google_container_node_pool" "np_with_gpudirect" { @@ -5445,6 +5449,10 @@ resource "google_container_cluster" "cluster" { node_config { machine_type = "e2-micro" } + + lifecycle { + ignore_changes = [node_config] + } min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"] network = "%s" subnetwork = "%s" @@ -5487,6 +5495,10 @@ resource "google_container_cluster" "cluster" { node_config { machine_type = "e2-micro" } + + lifecycle { + ignore_changes = [node_config] + } min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"] network = "%s" subnetwork = "%s" @@ -6302,6 +6314,10 @@ resource "google_container_cluster" "primary" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + deletion_protection = false network = "%{network}" subnetwork = "%{subnet}" @@ -6352,6 +6368,10 @@ resource "google_container_cluster" "primary" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + deletion_protection = false network = "%{network}" subnetwork = "%{subnet}" @@ -6403,6 +6423,10 @@ resource "google_container_cluster" "primary" { machine_type = "e2-micro" } + lifecycle { + ignore_changes = [node_config] + } + deletion_protection = false network = "%{network}" subnetwork = "%{subnet}" @@ -7035,7 +7059,11 @@ resource "google_container_cluster" "primary" { remove_default_node_pool = true initial_node_count = 1 node_config { - machine_type = "e2-micro" + machine_type = "e2-medium" + } + + lifecycle { + ignore_changes = [node_config] } datapath_provider = "ADVANCED_DATAPATH" @@ -7512,6 +7540,10 @@ resource "google_container_cluster" "cluster" { node_config { machine_type = "e2-micro" } + + lifecycle { + ignore_changes = [node_config] + } } resource "google_container_node_pool" "np" { From 2cd759840647c8dcd869b0ae8dc8c64d9790a22c Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Sat, 12 Sep 2026 11:22:33 -0700 Subject: [PATCH 5/7] container: use e2-medium for withRDMA test default pool --- .../container/resource_container_node_pool_test.go.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl index 29d15058facd..a5413e19e3a7 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl @@ -5021,7 +5021,7 @@ resource "google_container_cluster" "cluster" { initial_node_count = 1 remove_default_node_pool = true node_config { - machine_type = "e2-micro" + machine_type = "e2-medium" } lifecycle { From 64bd0054bd032afef54ab0ba58ea79d962e62376 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Mon, 14 Sep 2026 11:54:20 -0700 Subject: [PATCH 6/7] Update mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go Co-authored-by: Chris Hawk --- .../services/container/resource_container_cluster_sweeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go b/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go index b78669701c4e..94d4fbf432fa 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_sweeper.go @@ -64,7 +64,7 @@ func testSweepContainerClusters(region string) error { if err != nil { log.Printf("Error, failed to delete cluster %s: %s", cluster.Name, err) - return nil + continue } } From dabe5a8ab30cefb3a849393eeee21a3318a8a4f5 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Mon, 14 Sep 2026 13:33:16 -0700 Subject: [PATCH 7/7] container: ensure consistent initial_node_count across multi-step tests --- .../container/resource_container_cluster_test.go.tmpl | 6 +++--- .../container/resource_container_node_pool_test.go.tmpl | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index 16aa40f97019..e238ea4cbc9a 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -11683,7 +11683,7 @@ resource "google_container_cluster" "with_node_pool" { node_pool { name = "%s" - initial_node_count = 2 + initial_node_count = 1 autoscaling { min_node_count = 1 max_node_count = 3 @@ -11705,7 +11705,7 @@ resource "google_container_cluster" "with_node_pool" { node_pool { name = "%s" - initial_node_count = 2 + initial_node_count = 1 autoscaling { min_node_count = 1 max_node_count = 5 @@ -11788,7 +11788,7 @@ resource "google_container_cluster" "with_node_pool" { node_pool { name = "%s" - initial_node_count = 1 + initial_node_count = 2 } network = "%s" subnetwork = "%s" diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl index a5413e19e3a7..4fcb30e4e0f4 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl @@ -3574,7 +3574,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 autoscaling { min_node_count = 1 max_node_count = 3 @@ -3661,7 +3661,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1" cluster = google_container_cluster.cluster.name - initial_node_count = 1 + initial_node_count = 2 } `, cluster, networkName, subnetworkName, np) } @@ -3681,7 +3681,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 autoscaling { min_node_count = 1 max_node_count = 3 @@ -3705,7 +3705,7 @@ resource "google_container_node_pool" "np" { name = "%s" location = "us-central1-a" cluster = google_container_cluster.cluster.name - initial_node_count = 2 + initial_node_count = 1 autoscaling { min_node_count = 0 max_node_count = 5