From e1bbc599ed8d7bb79e6dad48363859d8930c5619 Mon Sep 17 00:00:00 2001 From: Rik Ribbers Date: Sun, 26 Jul 2020 12:58:19 +0200 Subject: [PATCH] Added signin_tenant to api_management_identity_provider_aad resource --- .../api_management_identity_provider_aad_resource.go | 8 ++++++++ .../api_management_identity_provider_aad_resource_test.go | 1 + .../r/api_management_identity_provider_aad.html.markdown | 2 ++ 3 files changed, 11 insertions(+) diff --git a/azurerm/internal/services/apimanagement/api_management_identity_provider_aad_resource.go b/azurerm/internal/services/apimanagement/api_management_identity_provider_aad_resource.go index 979fc73084d3..c0e40b35e6ad 100644 --- a/azurerm/internal/services/apimanagement/api_management_identity_provider_aad_resource.go +++ b/azurerm/internal/services/apimanagement/api_management_identity_provider_aad_resource.go @@ -58,6 +58,11 @@ func resourceArmApiManagementIdentityProviderAAD() *schema.Resource { ValidateFunc: validation.IsUUID, }, }, + "signin_tenant": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsUUID, + }, }, } } @@ -72,6 +77,7 @@ func resourceArmApiManagementIdentityProviderAADCreateUpdate(d *schema.ResourceD clientID := d.Get("client_id").(string) clientSecret := d.Get("client_secret").(string) allowedTenants := d.Get("allowed_tenants").([]interface{}) + signinTenant := d.Get("signin_tenant").(string) if d.IsNewResource() { existing, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.Aad) @@ -92,6 +98,7 @@ func resourceArmApiManagementIdentityProviderAADCreateUpdate(d *schema.ResourceD ClientSecret: utils.String(clientSecret), Type: apimanagement.Aad, AllowedTenants: utils.ExpandStringSlice(allowedTenants), + SigninTenant: utils.String(signinTenant), }, } @@ -141,6 +148,7 @@ func resourceArmApiManagementIdentityProviderAADRead(d *schema.ResourceData, met if props := resp.IdentityProviderContractProperties; props != nil { d.Set("client_id", props.ClientID) d.Set("allowed_tenants", props.AllowedTenants) + d.Set("signin_tenant", props.SigninTenant) } return nil diff --git a/azurerm/internal/services/apimanagement/tests/api_management_identity_provider_aad_resource_test.go b/azurerm/internal/services/apimanagement/tests/api_management_identity_provider_aad_resource_test.go index 9dcbf4440dc7..f4f03d70837e 100644 --- a/azurerm/internal/services/apimanagement/tests/api_management_identity_provider_aad_resource_test.go +++ b/azurerm/internal/services/apimanagement/tests/api_management_identity_provider_aad_resource_test.go @@ -159,6 +159,7 @@ resource "azurerm_api_management_identity_provider_aad" "test" { api_management_name = azurerm_api_management.test.name client_id = "00000000-0000-0000-0000-000000000000" client_secret = "00000000000000000000000000000000" + signin_tenant = "00000000-0000-0000-0000-000000000000" allowed_tenants = ["%s"] } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.Client().TenantID) diff --git a/website/docs/r/api_management_identity_provider_aad.html.markdown b/website/docs/r/api_management_identity_provider_aad.html.markdown index 8a52cda8ab0c..c51f207710d3 100644 --- a/website/docs/r/api_management_identity_provider_aad.html.markdown +++ b/website/docs/r/api_management_identity_provider_aad.html.markdown @@ -50,6 +50,8 @@ The following arguments are supported: * `allowed_tenants` - (Required) List of allowed AAD Tenants. +* `signin_tenant` - (Optional) The AAD Tenant to use instead of Common when logging into Active Directory + --- ## Attributes Reference