From b083fd57355461a2c7addda5aa7be88eccfd395b Mon Sep 17 00:00:00 2001 From: Daniel Poon <17039704+danielpoonwj@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:38:37 +0800 Subject: [PATCH 1/2] Allow specifying webhook_ids for Tenant create and update --- fusionauth/resource_fusionauth_tenant.go | 6 ++++++ fusionauth/resource_fusionauth_tenant_crud.go | 2 ++ 2 files changed, 8 insertions(+) diff --git a/fusionauth/resource_fusionauth_tenant.go b/fusionauth/resource_fusionauth_tenant.go index c1c9dd2..32f07c4 100644 --- a/fusionauth/resource_fusionauth_tenant.go +++ b/fusionauth/resource_fusionauth_tenant.go @@ -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, diff --git a/fusionauth/resource_fusionauth_tenant_crud.go b/fusionauth/resource_fusionauth_tenant_crud.go index 28318b8..d7f4b2d 100644 --- a/fusionauth/resource_fusionauth_tenant_crud.go +++ b/fusionauth/resource_fusionauth_tenant_crud.go @@ -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 = "" @@ -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) From 9d049e80cfa523065329e9dce7efa8ecaaad52f8 Mon Sep 17 00:00:00 2001 From: Daniel Poon <17039704+danielpoonwj@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:14:00 +0800 Subject: [PATCH 2/2] Update docs --- docs/resources/tenant.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/resources/tenant.md b/docs/resources/tenant.md index 280db24..56eeb1a 100644 --- a/docs/resources/tenant.md +++ b/docs/resources/tenant.md @@ -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.