-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Resource: `azurerm_api_management_identity_provider_microso… (#5369)
Partially addresses: #5044 Adds the azurerm_api_management_identity_provider_microsoft resource. --- PASS: TestAccAzureRMApiManagementIdentityProviderMicrosoft_basic (1937.19s) --- PASS: TestAccAzureRMApiManagementIdentityProviderMicrosoft_update (1944.11s) PASS ok github.com/terraform-providers/terraform-provider-azurerm/azurer
- v4.14.0
- v4.13.0
- v4.12.0
- v4.11.0
- v4.10.0
- v4.9.0
- v4.8.0
- v4.7.0
- v4.6.0
- v4.5.0
- v4.4.0
- v4.3.0
- v4.2.0
- v4.1.0
- v4.0.1
- v4.0.0
- v3.117.0
- v3.116.0
- v3.115.0
- v3.114.0
- v3.113.0
- v3.112.0
- v3.111.0
- v3.110.0
- v3.109.0
- v3.108.0
- v3.107.0
- v3.106.1
- v3.106.0
- v3.105.0
- v3.104.2
- v3.104.1
- v3.104.0
- v3.103.1
- v3.103.0
- v3.102.0
- v3.101.0
- v3.100.0
- v3.99.0
- v3.98.0
- v3.97.1
- v3.97.0
- v3.96.0
- v3.95.0
- v3.94.0
- v3.93.0
- v3.92.0
- v3.91.0
- v3.90.0
- v3.89.0
- v3.88.0
- v3.87.0
- v3.86.0
- v3.85.0
- v3.84.0
- v3.83.0
- v3.82.0
- v3.81.0
- v3.80.0
- v3.79.0
- v3.78.0
- v3.77.0
- v3.76.0
- v3.75.0
- v3.74.0
- v3.73.0
- v3.72.0
- v3.71.0
- v3.70.0
- v3.69.0
- v3.68.0
- v3.67.0
- v3.66.0
- v3.65.0
- v3.64.0
- v3.63.0
- v3.62.1
- v3.62.0
- v3.61.0
- v3.60.0
- v3.59.0
- v3.58.0
- v3.57.0
- v3.56.0
- v3.55.0
- v3.54.0
- v3.53.0
- v3.52.0
- v3.51.0
- v3.50.0
- v3.49.0
- v3.48.0
- v3.47.0
- v3.46.0
- v3.45.0
- v3.44.1
- v3.44.0
- v3.43.0
- v3.42.0
- v3.41.0
- v3.40.0
- v3.39.1
- v3.39.0
- v3.38.0
- v3.37.0
- v3.36.0
- v3.35.0
- v3.34.0
- v3.33.0
- v3.32.0
- v3.31.0
- v3.30.0
- v3.29.1
- v3.29.0
- v3.28.0
- v3.27.0
- v3.26.0
- v3.25.0
- v3.24.0
- v3.23.0
- v3.22.0
- v3.21.1
- v3.21.0
- v3.20.0
- v3.19.1
- v3.19.0
- v3.18.0
- v3.17.0
- v3.16.0
- v3.15.1
- v3.15.0
- v3.14.0
- v3.13.0
- v3.12.0
- v3.11.0
- v3.10.0
- v3.9.0
- v3.8.0
- v3.7.0
- v3.6.0
- v3.5.0
- v3.4.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- v2.99.0
- v2.98.0
- v2.97.0
- v2.96.0
- v2.95.0
- v2.94.0
- v2.93.1
- v2.93.0
- v2.92.0
- v2.91.0
- v2.90.0
- v2.89.0
- v2.88.1
- v2.88.0
- v2.87.0
- v2.86.0
- v2.85.0
- v2.84.0
- v2.83.0
- v2.82.0
- v2.81.0
- v2.80.0
- v2.79.1
- v2.79.0
- v2.78.0
- v2.77.0
- v2.76.0
- v2.75.0
- v2.74.0
- v2.73.0
- v2.72.0
- v2.71.0
- v2.70.0
- v2.69.0
- v2.68.0
- v2.67.0
- v2.66.0
- v2.65.0
- v2.64.0
- v2.63.0
- v2.62.1
- v2.62.0
- v2.61.0
- v2.60.0
- v2.59.0
- v2.58.0
- v2.57.0
- v2.56.0
- v2.55.0
- v2.54.0
- v2.53.0
- v2.52.0
- v2.51.0
- v2.50.0
- v2.49.0
- v2.48.0
- v2.47.0
- v2.46.1
- v2.46.0
- v2.45.1
- v2.45.0
- v2.44.0
- v2.43.0
- v2.42.0
- v2.41.0
- v2.40.0
- v2.39.0
- v2.38.0
- v2.37.0
- v2.36.0
- v2.35.0
- v2.34.0
- v2.33.0
- v2.32.0
- v2.31.1
- v2.31.0
- v2.30.0
- v2.29.0
- v2.28.0
- v2.27.0
- v2.26.0
- v2.25.0
- v2.24.0
- v2.23.0
- v2.22.0
- v2.21.0
- v2.20.0
- v2.19.0
- v2.18.0
- v2.17.0
- v2.16.0
- v2.15.0
- v2.14.0
- v2.13.0
- v2.12.0
- v2.11.0
- v2.10.0
- v2.9.0
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v1.44.0
- v1.43.0
- v1.42.0
- v1.41.0
Showing
4 changed files
with
450 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
159 changes: 159 additions & 0 deletions
159
...nternal/services/apimanagement/resource_arm_api_management_identity_provider_microsoft.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
package apimanagement | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"time" | ||
|
||
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement" | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" | ||
) | ||
|
||
func resourceArmApiManagementIdentityProviderMicrosoft() *schema.Resource { | ||
return &schema.Resource{ | ||
Create: resourceArmApiManagementIdentityProviderMicrosoftCreateUpdate, | ||
Read: resourceArmApiManagementIdentityProviderMicrosoftRead, | ||
Update: resourceArmApiManagementIdentityProviderMicrosoftCreateUpdate, | ||
Delete: resourceArmApiManagementIdentityProviderMicrosoftDelete, | ||
Importer: &schema.ResourceImporter{ | ||
State: schema.ImportStatePassthrough, | ||
}, | ||
|
||
Timeouts: &schema.ResourceTimeout{ | ||
Create: schema.DefaultTimeout(30 * time.Minute), | ||
Read: schema.DefaultTimeout(5 * time.Minute), | ||
Update: schema.DefaultTimeout(30 * time.Minute), | ||
Delete: schema.DefaultTimeout(30 * time.Minute), | ||
}, | ||
|
||
Schema: map[string]*schema.Schema{ | ||
"resource_group_name": azure.SchemaResourceGroupName(), | ||
|
||
"api_management_name": azure.SchemaApiManagementName(), | ||
|
||
"client_id": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ValidateFunc: validate.GUID, | ||
}, | ||
|
||
"client_secret": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Sensitive: true, | ||
ValidateFunc: validate.NoEmptyStrings, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func resourceArmApiManagementIdentityProviderMicrosoftCreateUpdate(d *schema.ResourceData, meta interface{}) error { | ||
client := meta.(*clients.Client).ApiManagement.IdentityProviderClient | ||
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) | ||
defer cancel() | ||
|
||
resourceGroup := d.Get("resource_group_name").(string) | ||
serviceName := d.Get("api_management_name").(string) | ||
clientID := d.Get("client_id").(string) | ||
clientSecret := d.Get("client_secret").(string) | ||
|
||
if features.ShouldResourcesBeImported() && d.IsNewResource() { | ||
existing, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.Microsoft) | ||
if err != nil { | ||
if !utils.ResponseWasNotFound(existing.Response) { | ||
return fmt.Errorf("Error checking for presence of existing Identity Provider %q (API Management Service %q / Resource Group %q): %s", apimanagement.Microsoft, serviceName, resourceGroup, err) | ||
} | ||
} | ||
|
||
if existing.ID != nil && *existing.ID != "" { | ||
return tf.ImportAsExistsError("azurerm_api_management_identity_provider_microsoft", *existing.ID) | ||
} | ||
} | ||
|
||
parameters := apimanagement.IdentityProviderContract{ | ||
IdentityProviderContractProperties: &apimanagement.IdentityProviderContractProperties{ | ||
ClientID: utils.String(clientID), | ||
ClientSecret: utils.String(clientSecret), | ||
Type: apimanagement.Microsoft, | ||
}, | ||
} | ||
|
||
if _, err := client.CreateOrUpdate(ctx, resourceGroup, serviceName, apimanagement.Microsoft, parameters, ""); err != nil { | ||
return fmt.Errorf("Error creating or updating Identity Provider %q (Resource Group %q / API Management Service %q): %+v", apimanagement.Microsoft, resourceGroup, serviceName, err) | ||
} | ||
|
||
resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.Microsoft) | ||
if err != nil { | ||
return fmt.Errorf("Error retrieving Identity Provider %q (Resource Group %q / API Management Service %q): %+v", apimanagement.Microsoft, resourceGroup, serviceName, err) | ||
} | ||
if resp.ID == nil { | ||
return fmt.Errorf("Cannot read ID for Identity Provider %q (Resource Group %q / API Management Service %q)", apimanagement.Microsoft, resourceGroup, serviceName) | ||
} | ||
d.SetId(*resp.ID) | ||
|
||
return resourceArmApiManagementIdentityProviderMicrosoftRead(d, meta) | ||
} | ||
|
||
func resourceArmApiManagementIdentityProviderMicrosoftRead(d *schema.ResourceData, meta interface{}) error { | ||
client := meta.(*clients.Client).ApiManagement.IdentityProviderClient | ||
ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) | ||
defer cancel() | ||
|
||
id, err := azure.ParseAzureResourceID(d.Id()) | ||
if err != nil { | ||
return err | ||
} | ||
resourceGroup := id.ResourceGroup | ||
serviceName := id.Path["service"] | ||
identityProviderName := id.Path["identityProviders"] | ||
|
||
resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName)) | ||
if err != nil { | ||
if utils.ResponseWasNotFound(resp.Response) { | ||
log.Printf("[DEBUG] Identity Provider %q (Resource Group %q / API Management Service %q) was not found - removing from state!", identityProviderName, resourceGroup, serviceName) | ||
d.SetId("") | ||
return nil | ||
} | ||
|
||
return fmt.Errorf("Error making Read request for Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) | ||
} | ||
|
||
d.Set("resource_group_name", resourceGroup) | ||
d.Set("api_management_name", serviceName) | ||
|
||
if props := resp.IdentityProviderContractProperties; props != nil { | ||
d.Set("client_id", props.ClientID) | ||
d.Set("client_secret", props.ClientSecret) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func resourceArmApiManagementIdentityProviderMicrosoftDelete(d *schema.ResourceData, meta interface{}) error { | ||
client := meta.(*clients.Client).ApiManagement.IdentityProviderClient | ||
ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) | ||
defer cancel() | ||
|
||
id, err := azure.ParseAzureResourceID(d.Id()) | ||
if err != nil { | ||
return err | ||
} | ||
resourceGroup := id.ResourceGroup | ||
serviceName := id.Path["service"] | ||
identityProviderName := id.Path["identityProviders"] | ||
|
||
if resp, err := client.Delete(ctx, resourceGroup, serviceName, apimanagement.IdentityProviderType(identityProviderName), ""); err != nil { | ||
if !utils.ResponseWasNotFound(resp) { | ||
return fmt.Errorf("Error deleting Identity Provider %q (Resource Group %q / API Management Service %q): %+v", identityProviderName, resourceGroup, serviceName, err) | ||
} | ||
} | ||
|
||
return nil | ||
} |
200 changes: 200 additions & 0 deletions
200
...vices/apimanagement/tests/resource_arm_api_management_identity_provider_microsoft_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
package tests | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/Azure/azure-sdk-for-go/services/apimanagement/mgmt/2018-01-01/apimanagement" | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-sdk/terraform" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" | ||
) | ||
|
||
func TestAccAzureRMApiManagementIdentityProviderMicrosoft_basic(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management_identity_provider_microsoft", "test") | ||
config := testAccAzureRMApiManagementIdentityProviderMicrosoft_basic(data) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementIdentityProviderMicrosoftDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: config, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementIdentityProviderMicrosoftExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagementIdentityProviderMicrosoft_update(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management_identity_provider_microsoft", "test") | ||
config := testAccAzureRMApiManagementIdentityProviderMicrosoft_basic(data) | ||
updateConfig := testAccAzureRMApiManagementIdentityProviderMicrosoft_update(data) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementIdentityProviderMicrosoftDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: config, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementIdentityProviderMicrosoftExists(data.ResourceName), | ||
resource.TestCheckResourceAttr(data.ResourceName, "client_id", "00000000-0000-0000-0000-000000000000"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "client_secret", "00000000000000000000000000000000"), | ||
), | ||
}, | ||
{ | ||
Config: updateConfig, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementIdentityProviderMicrosoftExists(data.ResourceName), | ||
resource.TestCheckResourceAttr(data.ResourceName, "client_id", "11111111-1111-1111-1111-111111111111"), | ||
resource.TestCheckResourceAttr(data.ResourceName, "client_secret", "11111111111111111111111111111111"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagementIdentityProviderMicrosoft_requiresImport(t *testing.T) { | ||
if !features.ShouldResourcesBeImported() { | ||
t.Skip("Skipping since resources aren't required to be imported") | ||
return | ||
} | ||
data := acceptance.BuildTestData(t, "azurerm_api_management_identity_provider_microsoft", "test") | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementIdentityProviderMicrosoftDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMApiManagementIdentityProviderMicrosoft_basic(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementIdentityProviderMicrosoftExists(data.ResourceName), | ||
), | ||
}, | ||
data.RequiresImportErrorStep(testAccAzureRMApiManagementIdentityProviderMicrosoft_requiresImport), | ||
}, | ||
}) | ||
} | ||
|
||
func testCheckAzureRMApiManagementIdentityProviderMicrosoftDestroy(s *terraform.State) error { | ||
client := acceptance.AzureProvider.Meta().(*clients.Client).ApiManagement.IdentityProviderClient | ||
for _, rs := range s.RootModule().Resources { | ||
if rs.Type != "azurerm_api_management_identity_provider_microsoft" { | ||
continue | ||
} | ||
|
||
resourceGroup := rs.Primary.Attributes["resource_group_name"] | ||
serviceName := rs.Primary.Attributes["api_management_name"] | ||
|
||
ctx := acceptance.AzureProvider.Meta().(*clients.Client).StopContext | ||
resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.Microsoft) | ||
|
||
if err != nil { | ||
if !utils.ResponseWasNotFound(resp.Response) { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
return nil | ||
} | ||
|
||
func testCheckAzureRMApiManagementIdentityProviderMicrosoftExists(resourceName string) resource.TestCheckFunc { | ||
return func(s *terraform.State) error { | ||
rs, ok := s.RootModule().Resources[resourceName] | ||
if !ok { | ||
return fmt.Errorf("Not found: %s", resourceName) | ||
} | ||
|
||
resourceGroup := rs.Primary.Attributes["resource_group_name"] | ||
serviceName := rs.Primary.Attributes["api_management_name"] | ||
|
||
client := acceptance.AzureProvider.Meta().(*clients.Client).ApiManagement.IdentityProviderClient | ||
ctx := acceptance.AzureProvider.Meta().(*clients.Client).StopContext | ||
resp, err := client.Get(ctx, resourceGroup, serviceName, apimanagement.Microsoft) | ||
if err != nil { | ||
if utils.ResponseWasNotFound(resp.Response) { | ||
return fmt.Errorf("Bad: API Management Identity Provider %q (Resource Group %q / API Management Service %q) does not exist", apimanagement.Microsoft, resourceGroup, serviceName) | ||
} | ||
return fmt.Errorf("Bad: Get on apiManagementIdentityProviderClient: %+v", err) | ||
} | ||
|
||
return nil | ||
} | ||
} | ||
|
||
func testAccAzureRMApiManagementIdentityProviderMicrosoft_basic(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-api-%d" | ||
location = "%s" | ||
} | ||
resource "azurerm_api_management" "test" { | ||
name = "acctestAM-%d" | ||
location = "${azurerm_resource_group.test.location}" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
publisher_name = "pub1" | ||
publisher_email = "pub1@email.com" | ||
sku_name = "Developer_1" | ||
} | ||
resource "azurerm_api_management_identity_provider_microsoft" "test" { | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
api_management_name = "${azurerm_api_management.test.name}" | ||
client_id = "00000000-0000-0000-0000-000000000000" | ||
client_secret = "00000000000000000000000000000000" | ||
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) | ||
} | ||
|
||
func testAccAzureRMApiManagementIdentityProviderMicrosoft_update(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-api-%d" | ||
location = "%s" | ||
} | ||
resource "azurerm_api_management" "test" { | ||
name = "acctestAM-%d" | ||
location = "${azurerm_resource_group.test.location}" | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
publisher_name = "pub1" | ||
publisher_email = "pub1@email.com" | ||
sku_name = "Developer_1" | ||
} | ||
resource "azurerm_api_management_identity_provider_microsoft" "test" { | ||
resource_group_name = "${azurerm_resource_group.test.name}" | ||
api_management_name = "${azurerm_api_management.test.name}" | ||
client_id = "11111111-1111-1111-1111-111111111111" | ||
client_secret = "11111111111111111111111111111111" | ||
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) | ||
} | ||
|
||
func testAccAzureRMApiManagementIdentityProviderMicrosoft_requiresImport(data acceptance.TestData) string { | ||
template := testAccAzureRMApiManagementIdentityProviderMicrosoft_basic(data) | ||
return fmt.Sprintf(` | ||
%s | ||
resource "azurerm_api_management_identity_provider_microsoft" "import" { | ||
resource_group_name = "${azurerm_api_management_identity_provider_microsoft.test.resource_group_name}" | ||
api_management_name = "${azurerm_api_management_identity_provider_microsoft.test.api_management_name}" | ||
client_id = "${azurerm_api_management_identity_provider_microsoft.test.client_id}" | ||
client_secret = "${azurerm_api_management_identity_provider_microsoft.test.client_secret}" | ||
} | ||
`, template) | ||
} |
64 changes: 64 additions & 0 deletions
64
website/docs/r/api_management_identity_provider_microsoft.html.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
subcategory: "API Management" | ||
layout: "azurerm" | ||
page_title: "Azure Resource Manager: azurerm_api_management_identity_provider_microsoft" | ||
description: |- | ||
Manages an API Management Microsoft Identity Provider. | ||
--- | ||
|
||
# azurerm_api_management_identity_provider_microsoft | ||
|
||
Manages an API Management Microsoft Identity Provider. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
resource "azurerm_resource_group" "example" { | ||
name = "example-resources" | ||
location = "West Europe" | ||
} | ||
resource "azurerm_api_management" "example" { | ||
name = "example-apim" | ||
location = "${azurerm_resource_group.example.location}" | ||
resource_group_name = "${azurerm_resource_group.example.name}" | ||
publisher_name = "My Company" | ||
publisher_email = "company@terraform.io" | ||
sku_name = "Developer_1" | ||
} | ||
resource "azurerm_api_management_identity_provider_microsoft" "example" { | ||
resource_group_name = "${azurerm_resource_group.example.name}" | ||
api_management_name = "${azurerm_api_management.example.name}" | ||
client_id = "00000000-0000-0000-0000-000000000000" | ||
client_secret = "00000000000000000000000000000000" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `api_management_name` - (Required) The Name of the API Management Service where this Microsoft Identity Provider should be created. Changing this forces a new resource to be created. | ||
|
||
* `resource_group_name` - (Required) The Name of the Resource Group where the API Management Service exists. Changing this forces a new resource to be created. | ||
|
||
* `client_id` - (Required) Client Id of the Azure AD Application. | ||
|
||
* `client_secret` - (Required) Client secret of the Azure AD Application. | ||
|
||
--- | ||
|
||
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
* `id` - The ID of the API Management Microsoft Identity Provider. | ||
|
||
## Import | ||
|
||
API Management Microsoft Identity Provider can be imported using the `resource id`, e.g. | ||
|
||
```shell | ||
terraform import azurerm_api_management_identity_provider_microsoft.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/identityProviders/microsoft | ||
``` |