Skip to content

Commit

Permalink
Cast auto-monitoring config to schema.Set before using
Browse files Browse the repository at this point in the history
  • Loading branch information
uol-jlin authored Jan 10, 2025
1 parent 46a8837 commit 87ac9c3
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 87ac9c3

Please sign in to comment.