Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tenant webhookids #287

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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