Skip to content

Commit 6432cf4

Browse files
Replaced hardcoded k8s versions in tests with the latest version for the stable channel (#7281) (#5206)
* Replaced hardcoded k8s versions in tests with the latest version for the stable channel Fixed hashicorp/terraform-provider-google#13271 * Downgraded TestAccContainerCluster_withMonitoringConfig to explicitly use 1.24.0 due to server-side constraints * Downgraded monitoring config tests to explicitly use 1.23.X due to server-side constraint Signed-off-by: Modular Magician <[email protected]>
1 parent 436d8f4 commit 6432cf4

File tree

2 files changed

+61
-18
lines changed

2 files changed

+61
-18
lines changed

.changelog/7281.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google-beta/resource_container_cluster_test.go

Lines changed: 58 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -756,10 +756,14 @@ func TestAccContainerCluster_withGcpPublicCidrsAccessEnabledToggle(t *testing.T)
756756
func testAccContainerCluster_withGcpPublicCidrsAccessEnabled(clusterName string, flag string) string {
757757

758758
return fmt.Sprintf(`
759+
data "google_container_engine_versions" "uscentral1a" {
760+
location = "us-central1-a"
761+
}
762+
759763
resource "google_container_cluster" "with_gcp_public_cidrs_access_enabled" {
760764
name = "%s"
761765
location = "us-central1-a"
762-
min_master_version = "1.23"
766+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
763767
initial_node_count = 1
764768
765769
master_authorized_networks_config {
@@ -772,10 +776,14 @@ resource "google_container_cluster" "with_gcp_public_cidrs_access_enabled" {
772776
func testAccContainerCluster_withoutGcpPublicCidrsAccessEnabled(clusterName string) string {
773777

774778
return fmt.Sprintf(`
779+
data "google_container_engine_versions" "uscentral1a" {
780+
location = "us-central1-a"
781+
}
782+
775783
resource "google_container_cluster" "with_gcp_public_cidrs_access_enabled" {
776784
name = "%s"
777785
location = "us-central1-a"
778-
min_master_version = "1.23"
786+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
779787
initial_node_count = 1
780788
}
781789
`, clusterName)
@@ -2565,7 +2573,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
25652573
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
25662574
Steps: []resource.TestStep{
25672575
{
2568-
Config: testAccContainerCluster_basic_1_23_8(clusterName),
2576+
Config: testAccContainerCluster_basic_1_23_16(clusterName),
25692577
},
25702578
{
25712579
ResourceName: "google_container_cluster.primary",
@@ -2611,7 +2619,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
26112619
},
26122620
// Back to basic settings to test setting Prometheus on its own
26132621
{
2614-
Config: testAccContainerCluster_basic_1_23_8(clusterName),
2622+
Config: testAccContainerCluster_basic_1_23_16(clusterName),
26152623
},
26162624
{
26172625
ResourceName: "google_container_cluster.primary",
@@ -2629,7 +2637,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) {
26292637
ImportStateVerifyIgnore: []string{"min_master_version"},
26302638
},
26312639
{
2632-
Config: testAccContainerCluster_basic_1_23_8(clusterName),
2640+
Config: testAccContainerCluster_basic_1_23_16(clusterName),
26332641
},
26342642
{
26352643
ResourceName: "google_container_cluster.primary",
@@ -4281,6 +4289,10 @@ func TestAccContainerCluster_withPrivateEndpointSubnetwork(t *testing.T) {
42814289

42824290
func testAccContainerCluster_withPrivateEndpointSubnetwork(containerNetName, clusterName, s1Name, s1Cidr, s2Name, s2Cidr string) string {
42834291
return fmt.Sprintf(`
4292+
data "google_container_engine_versions" "uscentral1a" {
4293+
location = "us-central1-a"
4294+
}
4295+
42844296
resource "google_compute_network" "container_network" {
42854297
name = "%s"
42864298
auto_create_subnetworks = false
@@ -4305,7 +4317,7 @@ resource "google_compute_subnetwork" "container_subnetwork2" {
43054317
resource "google_container_cluster" "with_private_endpoint_subnetwork" {
43064318
name = "%s"
43074319
location = "us-central1-a"
4308-
min_master_version = "1.23"
4320+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
43094321
initial_node_count = 1
43104322
43114323
network = google_compute_network.container_network.name
@@ -4389,10 +4401,14 @@ func TestAccContainerCluster_failedCreation(t *testing.T) {
43894401
func testAccContainerCluster_withEnablePrivateEndpoint(clusterName string, flag string) string {
43904402

43914403
return fmt.Sprintf(`
4404+
data "google_container_engine_versions" "uscentral1a" {
4405+
location = "us-central1-a"
4406+
}
4407+
43924408
resource "google_container_cluster" "with_enable_private_endpoint" {
43934409
name = "%s"
43944410
location = "us-central1-a"
4395-
min_master_version = "1.23"
4411+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
43964412
initial_node_count = 1
43974413
43984414
master_authorized_networks_config {
@@ -4409,10 +4425,14 @@ resource "google_container_cluster" "with_enable_private_endpoint" {
44094425
func testAccContainerCluster_withoutEnablePrivateEndpoint(clusterName string) string {
44104426

44114427
return fmt.Sprintf(`
4428+
data "google_container_engine_versions" "uscentral1a" {
4429+
location = "us-central1-a"
4430+
}
4431+
44124432
resource "google_container_cluster" "with_enable_private_endpoint" {
44134433
name = "%s"
44144434
location = "us-central1-a"
4415-
min_master_version = "1.23"
4435+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
44164436
initial_node_count = 1
44174437
44184438
master_authorized_networks_config {
@@ -5688,10 +5708,14 @@ resource "google_container_cluster" "with_node_pool" {
56885708

56895709
func testAccContainerRegionalCluster_withNodePoolCIA(cluster, np string) string {
56905710
return fmt.Sprintf(`
5711+
data "google_container_engine_versions" "uscentral1a" {
5712+
location = "us-central1-a"
5713+
}
5714+
56915715
resource "google_container_cluster" "with_node_pool" {
56925716
name = "%s"
56935717
location = "us-central1"
5694-
min_master_version = "1.24"
5718+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
56955719
56965720
node_pool {
56975721
name = "%s"
@@ -5708,10 +5732,14 @@ resource "google_container_cluster" "with_node_pool" {
57085732

57095733
func testAccContainerRegionalClusterUpdate_withNodePoolCIA(cluster, np string) string {
57105734
return fmt.Sprintf(`
5735+
data "google_container_engine_versions" "uscentral1a" {
5736+
location = "us-central1-a"
5737+
}
5738+
57115739
resource "google_container_cluster" "with_node_pool" {
57125740
name = "%s"
57135741
location = "us-central1"
5714-
min_master_version = "1.24"
5742+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
57155743
57165744
node_pool {
57175745
name = "%s"
@@ -5728,10 +5756,14 @@ resource "google_container_cluster" "with_node_pool" {
57285756

57295757
func testAccContainerRegionalCluster_withNodePoolBasic(cluster, nodePool string) string {
57305758
return fmt.Sprintf(`
5759+
data "google_container_engine_versions" "uscentral1a" {
5760+
location = "us-central1-a"
5761+
}
5762+
57315763
resource "google_container_cluster" "with_node_pool" {
57325764
name = "%s"
57335765
location = "us-central1"
5734-
min_master_version = "1.24"
5766+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
57355767
57365768
node_pool {
57375769
name = "%s"
@@ -6934,11 +6966,15 @@ resource "google_container_cluster" "with_dns_config" {
69346966

69356967
func testAccContainerCluster_withGatewayApiConfig(clusterName string, gatewayApiChannel string) string {
69366968
return fmt.Sprintf(`
6969+
data "google_container_engine_versions" "uscentral1a" {
6970+
location = "us-central1-a"
6971+
}
6972+
69376973
resource "google_container_cluster" "primary" {
69386974
name = "%s"
69396975
location = "us-central1-f"
69406976
initial_node_count = 1
6941-
min_master_version = "1.24"
6977+
min_master_version = data.google_container_engine_versions.uscentral1a.release_channel_latest_version["STABLE"]
69426978
gateway_api_config {
69436979
channel = "%s"
69446980
}
@@ -7017,24 +7053,28 @@ resource "google_container_cluster" "primary" {
70177053
`, name)
70187054
}
70197055

7020-
func testAccContainerCluster_basic_1_23_8(name string) string {
7056+
func testAccContainerCluster_basic_1_23_16(name string) string {
70217057
return fmt.Sprintf(`
70227058
resource "google_container_cluster" "primary" {
70237059
name = "%s"
70247060
location = "us-central1-a"
70257061
initial_node_count = 1
7026-
min_master_version = "1.23.8-gke.1900"
7062+
min_master_version = "1.23.16-gke.200"
70277063
}
70287064
`, name)
70297065
}
70307066

70317067
func testAccContainerCluster_withMonitoringConfigEnabled(name string) string {
70327068
return fmt.Sprintf(`
7069+
data "google_container_engine_versions" "uscentral1a" {
7070+
location = "us-central1-a"
7071+
}
7072+
70337073
resource "google_container_cluster" "primary" {
70347074
name = "%s"
70357075
location = "us-central1-a"
70367076
initial_node_count = 1
7037-
min_master_version = "1.23.8-gke.1900"
7077+
min_master_version = "1.23.16-gke.200"
70387078
monitoring_config {
70397079
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER" ]
70407080
}
@@ -7061,7 +7101,7 @@ resource "google_container_cluster" "primary" {
70617101
name = "%s"
70627102
location = "us-central1-a"
70637103
initial_node_count = 1
7064-
min_master_version = "1.23.8-gke.1900"
7104+
min_master_version = "1.23.16-gke.200"
70657105
monitoring_config {
70667106
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "WORKLOADS" ]
70677107
}
@@ -7075,7 +7115,7 @@ resource "google_container_cluster" "primary" {
70757115
name = "%s"
70767116
location = "us-central1-a"
70777117
initial_node_count = 1
7078-
min_master_version = "1.23.8-gke.1900"
7118+
min_master_version = "1.23.16-gke.200"
70797119
monitoring_config {
70807120
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER" ]
70817121
managed_prometheus {
@@ -7092,7 +7132,7 @@ resource "google_container_cluster" "primary" {
70927132
name = "%s"
70937133
location = "us-central1-a"
70947134
initial_node_count = 1
7095-
min_master_version = "1.23.8-gke.1900"
7135+
min_master_version = "1.23.16-gke.200"
70967136
monitoring_config {
70977137
enable_components = []
70987138
managed_prometheus {

0 commit comments

Comments
 (0)