Skip to content

Commit

Permalink
Merge pull request #287 from danielpoonwj/support-tenant-webhookids
Browse files Browse the repository at this point in the history
Support tenant webhookids
  • Loading branch information
johnjeffers authored Sep 11, 2024
2 parents 4f1f8b8 + 9d049e8 commit 876d123
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/resources/tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,9 @@ resource "fusionauth_tenant" "example" {

## Argument Reference
* `source_tenant_id` - (Optional) 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.
* `webhook_ids` - (Optional) 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` - (Optional) The Id to use for the new Tenant. If not specified a secure random UUID will be generated.
* `access_control_configuration` - (Optiona)
* `access_control_configuration` - (Optional)
- `ui_ip_access_control_list_id` - (Optional) The Id of the IP Access Control List limiting access to all applications in this tenant.
* `captcha_configuration` - (Optional)
- `enabled` - (Optional) Whether captcha configuration is enabled.
Expand Down
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 876d123

Please sign in to comment.