From a752e44193aea7b16cbec70bb4f1bc7f3c1630cc Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Tue, 11 Jul 2023 17:40:47 +0000 Subject: [PATCH] make monitoring_config enable_components optional (#8299) * make monitoring_config enable_components optional * set no change on logging_config.enable_components --------- Co-authored-by: Edward Sun Signed-off-by: Modular Magician --- .changelog/8299.txt | 4 ++++ google/resource_container_cluster_test.go | 24 +++++++++++++++++++ .../container/resource_container_cluster.go | 3 ++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .changelog/8299.txt diff --git a/.changelog/8299.txt b/.changelog/8299.txt new file mode 100644 index 00000000000..c30e6a76fc2 --- /dev/null +++ b/.changelog/8299.txt @@ -0,0 +1,4 @@ +```release-note:bug +container: made `monitoring_config.enable_components` optional on `google_container_cluster` (GA) + +``` diff --git a/google/resource_container_cluster_test.go b/google/resource_container_cluster_test.go index 58abd83246b..86d38396b67 100644 --- a/google/resource_container_cluster_test.go +++ b/google/resource_container_cluster_test.go @@ -2405,6 +2405,15 @@ func TestAccContainerCluster_withMonitoringConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"min_master_version"}, }, + { + Config: testAccContainerCluster_withMonitoringConfigPrometheusOnly2(clusterName), + }, + { + ResourceName: "google_container_cluster.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"min_master_version"}, + }, { Config: testAccContainerCluster_basic(clusterName), }, @@ -6421,6 +6430,21 @@ resource "google_container_cluster" "primary" { `, name) } +func testAccContainerCluster_withMonitoringConfigPrometheusOnly2(name string) string { + return fmt.Sprintf(` +resource "google_container_cluster" "primary" { + name = "%s" + location = "us-central1-a" + initial_node_count = 1 + monitoring_config { + managed_prometheus { + enabled = true + } + } +} +`, name) +} + func testAccContainerCluster_withSoleTenantGroup(name string) string { return fmt.Sprintf(` resource "google_compute_node_template" "soletenant-tmpl" { diff --git a/google/services/container/resource_container_cluster.go b/google/services/container/resource_container_cluster.go index 2d054d1809b..ea0be96779f 100644 --- a/google/services/container/resource_container_cluster.go +++ b/google/services/container/resource_container_cluster.go @@ -962,7 +962,8 @@ func ResourceContainerCluster() *schema.Resource { Schema: map[string]*schema.Schema{ "enable_components": { Type: schema.TypeList, - Required: true, + Optional: true, + Computed: true, Description: `GKE components exposing metrics. Valid values include SYSTEM_COMPONENTS, APISERVER, CONTROLLER_MANAGER, and SCHEDULER.`, Elem: &schema.Schema{ Type: schema.TypeString,