diff --git a/internal/provider/webhook_recipient_resource.go b/internal/provider/webhook_recipient_resource.go index 8efc7428..9db40c06 100644 --- a/internal/provider/webhook_recipient_resource.go +++ b/internal/provider/webhook_recipient_resource.go @@ -511,9 +511,9 @@ func validateTemplateVarsNotDuplicated(ctx context.Context, data models.WebhookR name := v.Name.ValueString() if duplicateMap[name] { resp.Diagnostics.AddAttributeError( - path.Root("template").AtListIndex(i).AtName("type"), + path.Root("template").AtListIndex(i).AtName("name"), "Conflicting configuration arguments", - fmt.Sprintf("cannot have more than one \"variable\" with the name \"%s\"", name), + fmt.Sprintf("cannot have more than one \"variable\" with the same \"name\""), ) } duplicateMap[name] = true diff --git a/internal/provider/webhook_recipient_resource_test.go b/internal/provider/webhook_recipient_resource_test.go index 6c2517b9..d9d9dad5 100644 --- a/internal/provider/webhook_recipient_resource_test.go +++ b/internal/provider/webhook_recipient_resource_test.go @@ -407,6 +407,37 @@ resource "honeycombio_webhook_recipient" "test" { }, }, }) + + resource.Test(t, resource.TestCase{ + PreCheck: testAccPreCheck(t), + ProtoV5ProviderFactories: testAccProtoV5MuxServerFactory, + CheckDestroy: testAccEnsureRecipientDestroyed(t), + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf(` +resource "honeycombio_webhook_recipient" "test" { + name = "%s" + url = "%s" + + template { + type = "trigger" + body = "body" + } + + variable { + name = "severity" + default_value = "critical" + } + + variable { + name = "severity" + default_value = "warning" + } +}`, name, url), + ExpectError: regexp.MustCompile(`cannot have more than one "variable" with the same "name"`), + }, + }, + }) }) }