From 4cca12941f9086ec5d05420bf9d9fe33d90be871 Mon Sep 17 00:00:00 2001 From: Benjamin Berriot <40873921+IIBenII@users.noreply.github.com> Date: Thu, 1 Dec 2022 00:19:12 +0100 Subject: [PATCH] Promoted `managed_prometheus` field in google_container_cluster` to GA (#6877) --- .../resources/resource_container_cluster.go.erb | 8 -------- .../tests/resource_container_cluster_test.go.erb | 16 +++++++++------- .../docs/r/container_cluster.html.markdown | 2 +- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb b/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb index ba16c0354753..68a564b3a285 100644 --- a/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb @@ -965,7 +965,6 @@ func resourceContainerCluster() *schema.Resource { <% end -%> }, }, -<% unless version == "ga" -%> "managed_prometheus": { Type: schema.TypeList, Optional: true, @@ -982,7 +981,6 @@ func resourceContainerCluster() *schema.Resource { }, }, }, -<% end -%> }, }, }, @@ -4381,14 +4379,12 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig EnableComponents: convertStringArr(enable_components), } } -<% unless version == 'ga' -%> if v, ok := config["managed_prometheus"]; ok && len(v.([]interface{})) > 0 { managed_prometheus := v.([]interface{})[0].(map[string]interface{}) mc.ManagedPrometheusConfig = &container.ManagedPrometheusConfig{ Enabled: managed_prometheus["enabled"].(bool), } } -<% end -%> return mc } @@ -5100,15 +5096,12 @@ func flattenMonitoringConfig(c *container.MonitoringConfig) []map[string]interfa if c.ComponentConfig != nil { result["enable_components"] = c.ComponentConfig.EnableComponents } -<% unless version == 'ga' -%> if c.ManagedPrometheusConfig != nil { result["managed_prometheus"] = flattenManagedPrometheusConfig(c.ManagedPrometheusConfig) } -<% end -%> return []map[string]interface{}{result} } -<% unless version == 'ga' -%> func flattenManagedPrometheusConfig(c *container.ManagedPrometheusConfig) []map[string]interface{} { return []map[string]interface{}{ { @@ -5116,7 +5109,6 @@ func flattenManagedPrometheusConfig(c *container.ManagedPrometheusConfig) []map[ }, } } -<% end -%> <% unless version == 'ga' -%> func flattenNodePoolAutoConfig(c *container.NodePoolAutoConfig) []map[string]interface{} { diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index bc67851be485..2478a90e9047 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -2549,7 +2549,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version"}, }, -<% if version == 'beta' -%> + <% if version == "beta" -%> { Config: testAccContainerCluster_withMonitoringConfigUpdated(clusterName), }, @@ -2559,6 +2559,7 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version"}, }, + <% end -%> { Config: testAccContainerCluster_withMonitoringConfigPrometheusUpdated(clusterName), }, @@ -2587,7 +2588,6 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version"}, }, -<% end -%> { Config: testAccContainerCluster_basic_1_23_8(clusterName), }, @@ -6873,7 +6873,7 @@ resource "google_container_cluster" "primary" { location = "us-central1-a" initial_node_count = 1 logging_config { - enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "WORKLOADS" ] + enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER"] } monitoring_config { enable_components = [ "SYSTEM_COMPONENTS" ] @@ -6920,7 +6920,7 @@ resource "google_container_cluster" "primary" { `, name) } -<% if version == 'beta' -%> +<% if version == "beta" -%> func testAccContainerCluster_withMonitoringConfigUpdated(name string) string { return fmt.Sprintf(` resource "google_container_cluster" "primary" { @@ -6934,6 +6934,7 @@ resource "google_container_cluster" "primary" { } `, name) } +<% end -%> func testAccContainerCluster_withMonitoringConfigPrometheusUpdated(name string) string { return fmt.Sprintf(` @@ -6943,7 +6944,7 @@ resource "google_container_cluster" "primary" { initial_node_count = 1 min_master_version = "1.23.8-gke.1900" monitoring_config { - enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER", "WORKLOADS" ] + enable_components = [ "SYSTEM_COMPONENTS", "APISERVER", "CONTROLLER_MANAGER", "SCHEDULER" ] managed_prometheus { enabled = true } @@ -6960,14 +6961,15 @@ resource "google_container_cluster" "primary" { initial_node_count = 1 min_master_version = "1.23.8-gke.1900" monitoring_config { + enable_components = [] managed_prometheus { - enabled = true + enabled = true } } } `, name) } -<% end -%> + func testAccContainerCluster_withSoleTenantGroup(name string) string { return fmt.Sprintf(` diff --git a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown index 7332fbd5f224..1cc428c3dddb 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -540,7 +540,7 @@ This block also contains several computed attributes, documented below. * `enable_components` - (Optional) The GKE components exposing metrics. Supported values include: `SYSTEM_COMPONENTS`, `APISERVER`, `CONTROLLER_MANAGER`, and `SCHEDULER`. In beta provider, `WORKLOADS` is supported on top of those 4 values. (`WORKLOADS` is deprecated and removed in GKE 1.24.) -* `managed_prometheus` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Configuration for Managed Service for Prometheus. Structure is [documented below](#nested_managed_prometheus). +* `managed_prometheus` - (Optional) Configuration for Managed Service for Prometheus. Structure is [documented below](#nested_managed_prometheus). The `managed_prometheus` block supports: