-
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.
- Loading branch information
yupwei68
committed
Jul 9, 2020
1 parent
e2ae0b6
commit fd0609b
Showing
2 changed files
with
195 additions
and
9 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
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 |
---|---|---|
|
@@ -325,6 +325,58 @@ func TestAccAzureRMApiManagement_identityUserAssigned(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identityNoneUpdateUserAssigned(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMApiManagement_identityNone(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep("identity.#", "identity.0.type", "identity.0.principal_id", "identity.0.tenant_id"), | ||
{ | ||
Config: testAccAzureRMApiManagement_identityUserAssigned(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identityUserAssignedUpdateNone(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMApiManagement_identityUserAssigned(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep(), | ||
{ | ||
Config: testAccAzureRMApiManagement_identityNone(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep("identity.#", "identity.0.type", "identity.0.principal_id", "identity.0.tenant_id"), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identitySystemAssigned(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
|
@@ -344,6 +396,58 @@ func TestAccAzureRMApiManagement_identitySystemAssigned(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identitySystemAssignedUpdateNone(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMApiManagement_identitySystemAssigned(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep(), | ||
{ | ||
Config: testAccAzureRMApiManagement_identityNone(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep("identity.#", "identity.0.type", "identity.0.principal_id", "identity.0.tenant_id"), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identityNoneUpdateSystemAssigned(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMApiManagement_identityNone(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep("identity.#", "identity.0.type", "identity.0.principal_id", "identity.0.tenant_id"), | ||
{ | ||
Config: testAccAzureRMApiManagement_identitySystemAssigned(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identitySystemAssignedUserAssigned(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
|
@@ -363,6 +467,58 @@ func TestAccAzureRMApiManagement_identitySystemAssignedUserAssigned(t *testing.T | |
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identitySystemAssignedUserAssignedUpdateNone(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMApiManagement_identitySystemAssignedUserAssigned(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep(), | ||
{ | ||
Config: testAccAzureRMApiManagement_identityNone(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep("identity.#", "identity.0.type", "identity.0.principal_id", "identity.0.tenant_id"), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identityNoneUpdateSystemAssignedUserAssigned(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acceptance.PreCheck(t) }, | ||
Providers: acceptance.SupportedProviders, | ||
CheckDestroy: testCheckAzureRMApiManagementDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAzureRMApiManagement_identityNone(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep("identity.#", "identity.0.type", "identity.0.principal_id", "identity.0.tenant_id"), | ||
{ | ||
Config: testAccAzureRMApiManagement_identitySystemAssignedUserAssigned(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_identitySystemAssignedUserAssignedUpdateSystemAssigned(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management", "test") | ||
|
||
|
@@ -844,6 +1000,33 @@ resource "azurerm_api_management" "test" { | |
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomIntOfLength(12)) | ||
} | ||
|
||
func testAccAzureRMApiManagement_identityNone(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
features {} | ||
} | ||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-%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 = "[email protected]" | ||
sku_name = "Developer_1" | ||
identity { | ||
type = "None" | ||
} | ||
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) | ||
} | ||
|
||
func testAccAzureRMApiManagement_identitySystemAssignedUpdateHostnameConfigurationsVersionlessKeyVaultId(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
|