Skip to content

Commit

Permalink
azurerm_api_management_identity_provider_aad - Support for `signin_…
Browse files Browse the repository at this point in the history
…tenant` #7901
  • Loading branch information
rikribbers authored Jul 29, 2020
1 parent 3c6c9c9 commit 22b0cf1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func resourceArmApiManagementIdentityProviderAAD() *schema.Resource {
ValidateFunc: validation.IsUUID,
},
},
"signin_tenant": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
},
},
}
}
Expand All @@ -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)
Expand All @@ -92,6 +98,7 @@ func resourceArmApiManagementIdentityProviderAADCreateUpdate(d *schema.ResourceD
ClientSecret: utils.String(clientSecret),
Type: apimanagement.Aad,
AllowedTenants: utils.ExpandStringSlice(allowedTenants),
SigninTenant: utils.String(signinTenant),
},
}

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 22b0cf1

Please sign in to comment.