Skip to content

Commit

Permalink
Cast auto-monitoring to *schema.Set instead of []interface{}
Browse files Browse the repository at this point in the history
  • Loading branch information
uol-jlin authored Jan 10, 2025
1 parent c38497a commit 46a8837
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5913,13 +5913,18 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig
Enabled: managed_prometheus["enabled"].(bool),
}
{{- if ne $.TargetVersionName "ga" }}
if autoMonitoring, ok := managed_prometheus["auto_monitoring_config"]; ok && len(autoMonitoring.([]interface{})) > 0 {
autoMonitoringConfig := autoMonitoring.([]interface{})[0].(map[string]interface{})
if scope, ok := autoMonitoringConfig["scope"].(string); ok {
mc.ManagedPrometheusConfig.AutoMonitoringConfig = &container.AutoMonitoringConfig {
Scope: scope,
}
}
if autoMonitoring, ok := managed_prometheus["auto_monitoring_config"]; ok {
if autoMonitoringSet, ok := autoMonitoring.(*schema.Set); ok {
autoMonitoringList := autoMonitoringSet.List()
if len(autoMonitoringList) > 0 {
autoMonitoringConfig := autoMonitoringList[0].(map[string]interface{})
if scope, ok := autoMonitoringConfig["scope"].(string); ok {
mc.ManagedPrometheusConfig.AutoMonitoringConfig = &container.AutoMonitoringConfig{
Scope: scope,
}
}
}
}
}
{{- end }}
}
Expand Down

0 comments on commit 46a8837

Please sign in to comment.