diff --git a/docs/resources/tenant.md b/docs/resources/tenant.md index 3709b7e..dd3df20 100644 --- a/docs/resources/tenant.md +++ b/docs/resources/tenant.md @@ -206,6 +206,7 @@ resource "fusionauth_tenant" "example" { ## Argument Reference * `source_tentant_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. +* `tenant_id` - (Optional) The Id to use for the new Tenant. If not specified a secure random UUID will be generated. * `data` - (Optional) An object that can hold any information about the Tenant that should be persisted. * `email_configuration` - (Required) - `default_from_name` - (Optional) The default From Name used in sending emails when a from name is not provided on an individual email template. This is the display name part of the email address ( i.e. Jared Dunn ). diff --git a/fusionauth/schema_fusionauth_tenant.go b/fusionauth/schema_fusionauth_tenant.go index 3e3e543..d181586 100644 --- a/fusionauth/schema_fusionauth_tenant.go +++ b/fusionauth/schema_fusionauth_tenant.go @@ -21,6 +21,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, }, + "tenant_id": { + Type: schema.TypeString, + Optional: true, + Description: "The Id to use for the new Tenant. If not specified a secure random UUID will be generated.", + ValidateFunc: validation.IsUUID, + }, "data": { Type: schema.TypeMap, Optional: true, @@ -1249,7 +1255,11 @@ func createTenant(data *schema.ResourceData, i interface{}) error { SourceTenantId: data.Get("source_tentant_id").(string), } - resp, faErrs, err := client.FAClient.CreateTenant("", t) + var tid string + if t, ok := data.GetOk("tenant_id"); ok { + tid = t.(string) + } + resp, faErrs, err := client.FAClient.CreateTenant(tid, t) if err != nil { return fmt.Errorf("CreateTenant err: %v", err)