-
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.
azurerm_api_management - support for virtual network integrati… (#5769)
The PR adds API Management virtual network integration both internal and external. Fixes #3667
- Loading branch information
1 parent
a9af902
commit 8b8adca
Showing
3 changed files
with
168 additions
and
13 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 |
---|---|---|
|
@@ -163,6 +163,26 @@ func TestAccAzureRMApiManagement_policy(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccAzureRMApiManagement_virtualNetworkInternal(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_virtualNetworkInternal(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMApiManagementExists(data.ResourceName), | ||
resource.TestCheckResourceAttr(data.ResourceName, "virtual_network_type", "Internal"), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}, | ||
}) | ||
} | ||
|
||
func testCheckAzureRMApiManagementDestroy(s *terraform.State) error { | ||
conn := acceptance.AzureProvider.Meta().(*clients.Client).ApiManagement.ServiceClient | ||
ctx := acceptance.AzureProvider.Meta().(*clients.Client).StopContext | ||
|
@@ -506,3 +526,45 @@ resource "azurerm_api_management" "test" { | |
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.Locations.Secondary, data.RandomInteger, data.Locations.Ternary, data.RandomInteger) | ||
} | ||
|
||
func testAccAzureRMApiManagement_virtualNetworkInternal(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
provider "azurerm" { | ||
features {} | ||
} | ||
resource "azurerm_resource_group" "test" { | ||
name = "acctestRG-%d" | ||
location = "%s" | ||
} | ||
resource "azurerm_virtual_network" "test" { | ||
name = "acctestVNET-%d" | ||
location = azurerm_resource_group.test.location | ||
resource_group_name = azurerm_resource_group.test.name | ||
address_space = ["10.0.0.0/16"] | ||
} | ||
resource "azurerm_subnet" "test" { | ||
name = "acctestSNET-%d" | ||
resource_group_name = azurerm_resource_group.test.name | ||
virtual_network_name = azurerm_virtual_network.test.name | ||
address_prefix = "10.0.1.0/24" | ||
} | ||
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" | ||
virtual_network_type = "Internal" | ||
virtual_network_configuration { | ||
subnet_id = azurerm_subnet.test.id | ||
} | ||
} | ||
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) | ||
} |
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