Skip to content

Commit

Permalink
Allow specifying webhook_ids for Tenant create and update
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpoonwj committed Jun 27, 2024
1 parent 64ced6b commit b083fd5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fusionauth/resource_fusionauth_tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ func newTenant() *schema.Resource {
Description: "The optional Id of an existing Tenant to make a copy of. If present, the tenant.id and tenant.name values of the request body will be applied to the new Tenant, all other values will be copied from the source Tenant to the new Tenant.",
ValidateFunc: validation.IsUUID,
},
"webhook_ids": {
Type: schema.TypeSet,
Elem: &schema.Schema{Type: schema.TypeString},
Optional: true,
Description: "An array of Webhook Ids. For Webhooks that are not already configured for All Tenants, specifying an Id on this request will indicate the associated Webhook should handle events for this tenant.",
},
"tenant_id": {
Type: schema.TypeString,
Optional: true,
Expand Down
2 changes: 2 additions & 0 deletions fusionauth/resource_fusionauth_tenant_crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func createTenant(_ context.Context, data *schema.ResourceData, i interface{}) d
t := fusionauth.TenantRequest{
Tenant: tenant,
SourceTenantId: data.Get("source_tenant_id").(string),
WebhookIds: handleStringSlice("webhook_ids", data),
}
client.FAClient.TenantId = ""

Expand Down Expand Up @@ -69,6 +70,7 @@ func updateTenant(_ context.Context, data *schema.ResourceData, i interface{}) d
t := fusionauth.TenantRequest{
Tenant: tenant,
SourceTenantId: data.Get("source_tenant_id").(string),
WebhookIds: handleStringSlice("webhook_ids", data),
}

resp, faErrs, err := client.FAClient.UpdateTenant(data.Id(), t)
Expand Down

0 comments on commit b083fd5

Please sign in to comment.