Skip to content

Commit 1fd2caa

Browse files
authored
Merge pull request #322 from grafana/bug-234
Make secure_settings always pass values as string
2 parents 4b895c0 + 4e9061d commit 1fd2caa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

grafana/resource_alert_notification.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,10 @@ func makeAlertNotification(_ context.Context, d *schema.ResourceData) (*gapi.Ale
224224
secureSettings := map[string]interface{}{}
225225
for k, v := range d.Get("secure_settings").(map[string]interface{}) {
226226
strVal, ok := v.(string)
227-
switch {
228-
case ok && strVal == "true":
229-
secureSettings[k] = true
230-
case ok && strVal == "false":
231-
secureSettings[k] = false
232-
default:
233-
secureSettings[k] = v
227+
if !ok {
228+
return nil, errors.New("secure_settings must be a map of string")
234229
}
230+
secureSettings[k] = strVal
235231
}
236232

237233
sendReminder := d.Get("send_reminder").(bool)

grafana/resource_alert_notification_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ resource "grafana_alert_notification" "test" {
186186
"uploadImage" = "false"
187187
"autoResolve" = "true"
188188
}
189+
secure_settings = {
190+
"foo" = "true"
191+
}
189192
}
190193
`
191194

0 commit comments

Comments
 (0)