@@ -38,6 +38,9 @@ func createAlertV2Schema(original map[string]*schema.Schema) map[string]*schema.
3838 Optional : true ,
3939 Default : string (v2 .AlertV2SeverityLow ),
4040 ValidateFunc : validation .StringInSlice (AlertV2SeverityValues (), true ),
41+ DiffSuppressFunc : func (k , old , new string , d * schema.ResourceData ) bool {
42+ return strings .EqualFold (old , new )
43+ },
4144 },
4245 "group" : {
4346 Type : schema .TypeString ,
@@ -201,10 +204,14 @@ func AlertLinkV2TypeValues() []string {
201204
202205func buildAlertV2CommonStruct (d * schema.ResourceData ) * v2.AlertV2Common {
203206 alert := & v2.AlertV2Common {
204- Name : d .Get ("name" ).(string ),
205- Type : "MANUAL" ,
206- Severity : d .Get ("severity" ).(string ),
207- Enabled : d .Get ("enabled" ).(bool ),
207+ Name : d .Get ("name" ).(string ),
208+ Type : "MANUAL" ,
209+ Enabled : d .Get ("enabled" ).(bool ),
210+ }
211+
212+ alert .Severity = strings .ToLower (d .Get ("severity" ).(string ))
213+ if alert .Severity == "info" {
214+ alert .Severity = "none"
208215 }
209216
210217 if description , ok := d .GetOk ("description" ); ok {
@@ -307,6 +314,9 @@ func updateAlertV2CommonState(d *schema.ResourceData, alert *v2.AlertV2Common) (
307314 _ = d .Set ("name" , alert .Name )
308315 _ = d .Set ("description" , alert .Description )
309316 _ = d .Set ("severity" , alert .Severity )
317+ if alert .Severity == "none" {
318+ _ = d .Set ("severity" , "info" )
319+ }
310320
311321 // optional with defaults
312322 _ = d .Set ("group" , alert .Group )
0 commit comments