Skip to content

Commit ad2ff30

Browse files
authored
Added support for additional values KCP_HPA in `google_container_clus… (#12221)
1 parent 634b382 commit ad2ff30

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1052,10 +1052,10 @@ func ResourceContainerCluster() *schema.Resource {
10521052
"enable_components": {
10531053
Type: schema.TypeList,
10541054
Required: true,
1055-
Description: `GKE components exposing logs. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, SCHEDULER, and WORKLOADS.`,
1055+
Description: `GKE components exposing logs. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, KCP_HPA, SCHEDULER, and WORKLOADS.`,
10561056
Elem: &schema.Schema{
10571057
Type: schema.TypeString,
1058-
ValidateFunc: validation.StringInSlice([]string{"SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "KCP_CONNECTION", "KCP_SSHD", "SCHEDULER", "WORKLOADS"}, false),
1058+
ValidateFunc: validation.StringInSlice([]string{"SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "KCP_CONNECTION", "KCP_SSHD", "KCP_HPA", "SCHEDULER", "WORKLOADS"}, false),
10591059
},
10601060
},
10611061
},

mmv1/third_party/terraform/services/container/resource_container_cluster_migratev1.go.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -755,10 +755,10 @@ func resourceContainerClusterResourceV1() *schema.Resource {
755755
"enable_components": {
756756
Type: schema.TypeList,
757757
Required: true,
758-
Description: `GKE components exposing logs. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, SCHEDULER, and WORKLOADS.`,
758+
Description: `GKE components exposing logs. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, KCP_CONNECTION, KCP_SSHD, KCP_HPA, SCHEDULER, and WORKLOADS.`,
759759
Elem: &schema.Schema{
760760
Type: schema.TypeString,
761-
ValidateFunc: validation.StringInSlice([]string{"SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "KCP_CONNECTION", "KCP_SSHD", "SCHEDULER", "WORKLOADS"}, false),
761+
ValidateFunc: validation.StringInSlice([]string{"SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "KCP_CONNECTION", "KCP_SSHD", "KCP_HPA", "SCHEDULER", "WORKLOADS"}, false),
762762
},
763763
},
764764
},

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

+36-17
Original file line numberDiff line numberDiff line change
@@ -3927,55 +3927,56 @@ func TestAccContainerCluster_withLoggingConfig(t *testing.T) {
39273927
clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10))
39283928
networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster")
39293929
subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName)
3930+
minVersion := "1.32"
39303931
acctest.VcrTest(t, resource.TestCase{
39313932
PreCheck: func() { acctest.AccTestPreCheck(t) },
39323933
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
39333934
CheckDestroy: testAccCheckContainerClusterDestroyProducer(t),
39343935
Steps: []resource.TestStep{
39353936
{
3936-
Config: testAccContainerCluster_basic(clusterName, networkName, subnetworkName),
3937+
Config: testAccContainerCluster_basicWithMinGKEVersion(clusterName, networkName, subnetworkName, minVersion),
39373938
},
39383939
{
39393940
ResourceName: "google_container_cluster.primary",
39403941
ImportState: true,
39413942
ImportStateVerify: true,
3942-
ImportStateVerifyIgnore: []string{"deletion_protection"},
3943+
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
39433944
},
39443945
{
3945-
Config: testAccContainerCluster_withLoggingConfigEnabled(clusterName, networkName, subnetworkName),
3946+
Config: testAccContainerCluster_withLoggingConfigEnabled(clusterName, networkName, subnetworkName, minVersion),
39463947
},
39473948
{
39483949
ResourceName: "google_container_cluster.primary",
39493950
ImportState: true,
39503951
ImportStateVerify: true,
3951-
ImportStateVerifyIgnore: []string{"deletion_protection"},
3952+
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
39523953
},
39533954
{
3954-
Config: testAccContainerCluster_withLoggingConfigDisabled(clusterName, networkName, subnetworkName),
3955+
Config: testAccContainerCluster_withLoggingConfigDisabled(clusterName, networkName, subnetworkName, minVersion),
39553956
},
39563957
{
39573958
ResourceName: "google_container_cluster.primary",
39583959
ImportState: true,
39593960
ImportStateVerify: true,
3960-
ImportStateVerifyIgnore: []string{"deletion_protection"},
3961+
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
39613962
},
39623963
{
3963-
Config: testAccContainerCluster_withLoggingConfigUpdated(clusterName, networkName, subnetworkName),
3964+
Config: testAccContainerCluster_withLoggingConfigUpdated(clusterName, networkName, subnetworkName, minVersion),
39643965
},
39653966
{
39663967
ResourceName: "google_container_cluster.primary",
39673968
ImportState: true,
39683969
ImportStateVerify: true,
3969-
ImportStateVerifyIgnore: []string{"deletion_protection"},
3970+
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
39703971
},
39713972
{
3972-
Config: testAccContainerCluster_basic(clusterName, networkName, subnetworkName),
3973+
Config: testAccContainerCluster_basicWithMinGKEVersion(clusterName, networkName, subnetworkName, minVersion),
39733974
},
39743975
{
39753976
ResourceName: "google_container_cluster.primary",
39763977
ImportState: true,
39773978
ImportStateVerify: true,
3978-
ImportStateVerifyIgnore: []string{"deletion_protection"},
3979+
ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"},
39793980
},
39803981
},
39813982
})
@@ -6310,6 +6311,21 @@ resource "google_container_cluster" "primary" {
63106311
`, name, networkName, subnetworkName)
63116312
}
63126313

6314+
func testAccContainerCluster_basicWithMinGKEVersion(name, networkName, subnetworkName string, minVersion string) string {
6315+
return fmt.Sprintf(`
6316+
resource "google_container_cluster" "primary" {
6317+
name = "%s"
6318+
location = "us-central1-a"
6319+
initial_node_count = 1
6320+
network = "%s"
6321+
subnetwork = "%s"
6322+
min_master_version = "%s"
6323+
6324+
deletion_protection = false
6325+
}
6326+
`, name, networkName, subnetworkName, minVersion)
6327+
}
6328+
63136329
func testAccContainerCluster_forSecretManagerConfig(projectID, name, networkName, subnetworkName string) string {
63146330
return fmt.Sprintf(`
63156331
data "google_project" "project" {
@@ -11003,7 +11019,7 @@ resource "google_container_cluster" "primary" {
1100311019
`, projectID, name, networkName, subnetworkName)
1100411020
}
1100511021

11006-
func testAccContainerCluster_withLoggingConfigEnabled(name, networkName, subnetworkName string) string {
11022+
func testAccContainerCluster_withLoggingConfigEnabled(name, networkName, subnetworkName string, minVersion string) string {
1100711023
return fmt.Sprintf(`
1100811024
resource "google_container_cluster" "primary" {
1100911025
name = "%s"
@@ -11018,11 +11034,12 @@ resource "google_container_cluster" "primary" {
1101811034
deletion_protection = false
1101911035
network = "%s"
1102011036
subnetwork = "%s"
11037+
min_master_version = "%s"
1102111038
}
11022-
`, name, networkName, subnetworkName)
11039+
`, name, networkName, subnetworkName, minVersion)
1102311040
}
1102411041

11025-
func testAccContainerCluster_withLoggingConfigDisabled(name, networkName, subnetworkName string) string {
11042+
func testAccContainerCluster_withLoggingConfigDisabled(name, networkName, subnetworkName string, minVersion string) string {
1102611043
return fmt.Sprintf(`
1102711044
resource "google_container_cluster" "primary" {
1102811045
name = "%s"
@@ -11034,27 +11051,29 @@ resource "google_container_cluster" "primary" {
1103411051
deletion_protection = false
1103511052
network = "%s"
1103611053
subnetwork = "%s"
11054+
min_master_version = "%s"
1103711055
}
11038-
`, name, networkName, subnetworkName)
11056+
`, name, networkName, subnetworkName, minVersion)
1103911057
}
1104011058

11041-
func testAccContainerCluster_withLoggingConfigUpdated(name, networkName, subnetworkName string) string {
11059+
func testAccContainerCluster_withLoggingConfigUpdated(name, networkName, subnetworkName string, minVersion string) string {
1104211060
return fmt.Sprintf(`
1104311061
resource "google_container_cluster" "primary" {
1104411062
name = "%s"
1104511063
location = "us-central1-a"
1104611064
initial_node_count = 1
1104711065
logging_config {
11048-
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "KCP_CONNECTION", "KCP_SSHD"]
11066+
enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "KCP_CONNECTION", "KCP_SSHD", "KCP_HPA"]
1104911067
}
1105011068
monitoring_config {
1105111069
enable_components = [ "SYSTEM_COMPONENTS" ]
1105211070
}
1105311071
deletion_protection = false
1105411072
network = "%s"
1105511073
subnetwork = "%s"
11074+
min_master_version = "%s"
1105611075
}
11057-
`, name, networkName, subnetworkName)
11076+
`, name, networkName, subnetworkName, minVersion)
1105811077
}
1105911078

1106011079
func testAccContainerCluster_withMonitoringConfigEnabled(name, networkName, subnetworkName string) string {

0 commit comments

Comments
 (0)