Skip to content

Commit

Permalink
make sure the schema defines variable in the right place
Browse files Browse the repository at this point in the history
  • Loading branch information
brookesargent committed Dec 20, 2024
1 parent dd05ad7 commit 3931259
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions internal/provider/notification_recipients.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,32 @@ func notificationRecipientSchema(allowedTypes []client.RecipientType) schema.Set
},
},
},
},
},
"variable": schema.SetNestedBlock{
Description: "The variables to set with the Webhook notification.",
Validators: []validator.Set{
setvalidator.SizeAtMost(10),
},
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
Required: true,
Description: "The name of the variable",
Validators: []validator.String{
stringvalidator.LengthBetween(1, 64),
stringvalidator.RegexMatches(webhookTemplateNameRegex, "must be an alphanumeric string beginning with a lowercase letter"),
Blocks: map[string]schema.Block{
"variable": schema.SetNestedBlock{
Description: "The variables to set with the webhook notification.",
Validators: []validator.Set{
setvalidator.SizeAtMost(10),
},
},
"value": schema.StringAttribute{
Description: "An optional default value for the variable",
Optional: true,
Computed: true,
Default: stringdefault.StaticString(""),
Validators: []validator.String{
stringvalidator.LengthAtMost(256),
NestedObject: schema.NestedBlockObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
Required: true,
Description: "The name of the variable",
Validators: []validator.String{
stringvalidator.LengthBetween(1, 64),
stringvalidator.RegexMatches(webhookTemplateNameRegex, "must be an alphanumeric string beginning with a lowercase letter"),
},
},
"value": schema.StringAttribute{
Description: "The variable value",
Optional: true,
Computed: true,
Default: stringdefault.StaticString(""),
Validators: []validator.String{
stringvalidator.LengthAtMost(256),
},
},
},
},
},
},
Expand Down

0 comments on commit 3931259

Please sign in to comment.