Skip to content

Commit

Permalink
[datadog-monitor] Allow default_tags values to contain colons (bugfix).
Browse files Browse the repository at this point in the history
Only separate the key before the first colon, all subsequent colons are
considered to be part of the value as stated in datadog docs.
  • Loading branch information
Amaury-Behague committed Dec 4, 2024
1 parent 4300165 commit af4f4e5
Show file tree
Hide file tree
Showing 4 changed files with 275 additions and 369 deletions.
4 changes: 3 additions & 1 deletion datadog/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,14 @@ func tagDiff(ctx context.Context, d *schema.ResourceDiff, meta interface{}) erro
kv := strings.Split(tag.(string), ":")
var key, value string
switch len(kv) {
case 0:
return fmt.Errorf("invalid tag: '%s'", tag)
case 2:
key, value = kv[0], kv[1]
case 1:
key, value = kv[0], ""
default:
return fmt.Errorf("invalid tag: '%s'", tag)
key, value = kv[0], strings.Join(kv[1:], ":")
}
tags[key] = value
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-07-12T15:58:49.631984+02:00
2024-12-04T13:18:38.138439+01:00
Loading

0 comments on commit af4f4e5

Please sign in to comment.