Skip to content

Commit

Permalink
[datadog_monitor_json] Ignore the POST null for the restriction_polic…
Browse files Browse the repository at this point in the history
…y field (#2373)
  • Loading branch information
nkzou committed Apr 22, 2024
1 parent 2f851db commit 48accc2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datadog/resource_datadog_monitor_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func resourceDatadogMonitorJSON() *schema.Resource {
if val := reflect.ValueOf(attrMap["restricted_roles"]); !val.IsValid() {
utils.DeleteKeyInMap(attrMap, []string{"restricted_roles"})
}
if val := reflect.ValueOf(attrMap["restriction_policy"]); !val.IsValid() {
utils.DeleteKeyInMap(attrMap, []string{"restriction_policy"})
}

res, _ := structure.FlattenJsonToString(attrMap)
return res
Expand Down Expand Up @@ -211,6 +214,9 @@ func updateMonitorJSONState(d *schema.ResourceData, monitor map[string]interface
if val := reflect.ValueOf(monitor["restricted_roles"]); !val.IsValid() {
utils.DeleteKeyInMap(monitor, []string{"restricted_roles"})
}
if val := reflect.ValueOf(monitor["restriction_policy"]); !val.IsValid() {
utils.DeleteKeyInMap(monitor, []string{"restriction_policy"})
}

monitorString, err := structure.FlattenJsonToString(monitor)
if err != nil {
Expand Down

0 comments on commit 48accc2

Please sign in to comment.