Skip to content

Commit 93e69c9

Browse files
committed
use optional field
1 parent 2bf27a7 commit 93e69c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/kibana/slo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic
599599
idx := fmt.Sprint(n)
600600
goodMetrics = append(goodMetrics, slo.IndicatorPropertiesCustomMetricParamsGoodMetricsInner{
601601
Name: d.Get(indicatorType + ".0.good.0.metrics." + idx + ".name").(string),
602-
Field: d.Get(indicatorType + ".0.good.0.metrics." + idx + ".field").(string),
602+
Field: getOrNilString(indicatorType+".0.good.0.metrics."+idx+".field", d),
603603
Aggregation: d.Get(indicatorType + ".0.good.0.metrics." + idx + ".aggregation").(string),
604604
Filter: getOrNilString(indicatorType+".0.good.0.metrics."+idx+".filter", d),
605605
})
@@ -610,7 +610,7 @@ func getSloFromResourceData(d *schema.ResourceData) (models.Slo, diag.Diagnostic
610610
idx := fmt.Sprint(n)
611611
totalMetrics = append(totalMetrics, slo.IndicatorPropertiesCustomMetricParamsTotalMetricsInner{
612612
Name: d.Get(indicatorType + ".0.total.0.metrics." + idx + ".name").(string),
613-
Field: d.Get(indicatorType + ".0.total.0.metrics." + idx + ".field").(string),
613+
Field: getOrNilString(indicatorType+".0.total.0.metrics."+idx+".field", d),
614614
Aggregation: d.Get(indicatorType + ".0.total.0.metrics." + idx + ".aggregation").(string),
615615
Filter: getOrNilString(indicatorType+".0.total.0.metrics."+idx+".filter", d),
616616
})

0 commit comments

Comments
 (0)