From 87ac9c304a92f86b140b7f2e3818c3e8c766dbb1 Mon Sep 17 00:00:00 2001 From: Jonathan <133916425+uol-jlin@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:42:54 -0500 Subject: [PATCH] Cast auto-monitoring config to schema.Set before using --- .../resource_container_cluster.go.tmpl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl index 8fca17c1efb9..957ede74acf8 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster.go.tmpl @@ -6913,13 +6913,18 @@ func flattenManagedPrometheusConfig(c *container.ManagedPrometheusConfig) []map[ result["enabled"] = c.Enabled {{- if ne $.TargetVersionName "ga" }} - if c.AutoMonitoringConfig != nil { - autoMonitoringMap := make(map[string]interface{}) - if c.AutoMonitoringConfig.Scope != "" { - autoMonitoringMap["scope"] = c.AutoMonitoringConfig.Scope - } - result["auto_monitoring_config"] = autoMonitoringMap - } + if c.AutoMonitoringConfig != nil { + autoMonitoringMap := make(map[string]interface{}) + if c.AutoMonitoringConfig.Scope != "" { + autoMonitoringMap["scope"] = c.AutoMonitoringConfig.Scope + } + + if set, ok := c.AutoMonitoringConfig.(*schema.Set); ok { + result["auto_monitoring_config"] = set + } else { + result["auto_monitoring_config"] = autoMonitoringMap + } + } {{- end }} return []map[string]interface{}{result}