-
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.
Support for
client_certificate_id
in `azurerm_api_management_backen…
…d` (#12402)
- Loading branch information
Showing
3 changed files
with
81 additions
and
5 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 |
---|---|---|
|
@@ -144,6 +144,21 @@ func TestAccApiManagementBackend_serviceFabric(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccApiManagementBackend_serviceFabricClientCertificateId(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management_backend", "test") | ||
r := ApiManagementAuthorizationBackendResource{} | ||
|
||
data.ResourceTest(t, r, []acceptance.TestStep{ | ||
{ | ||
Config: r.serviceFabricClientCertificateId(data), | ||
Check: acceptance.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
), | ||
}, | ||
data.ImportStep(), | ||
}) | ||
} | ||
|
||
func TestAccApiManagementBackend_disappears(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azurerm_api_management_backend", "test") | ||
r := ApiManagementAuthorizationBackendResource{} | ||
|
@@ -333,6 +348,39 @@ resource "azurerm_api_management_backend" "test" { | |
`, r.template(data, "sf"), data.RandomInteger) | ||
} | ||
|
||
func (r ApiManagementAuthorizationBackendResource) serviceFabricClientCertificateId(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
%s | ||
resource "azurerm_api_management_certificate" "test" { | ||
name = "example-cert" | ||
api_management_name = azurerm_api_management.test.name | ||
resource_group_name = azurerm_resource_group.test.name | ||
data = filebase64("testdata/keyvaultcert.pfx") | ||
password = "" | ||
} | ||
resource "azurerm_api_management_backend" "test" { | ||
name = "acctestapi-%d" | ||
resource_group_name = azurerm_resource_group.test.name | ||
api_management_name = azurerm_api_management.test.name | ||
protocol = "http" | ||
url = "fabric:/mytestapp/acctest" | ||
service_fabric_cluster { | ||
client_certificate_id = azurerm_api_management_certificate.test.id | ||
management_endpoints = [ | ||
"https://acctestsf.com", | ||
] | ||
max_partition_resolution_retries = 5 | ||
server_certificate_thumbprints = [ | ||
azurerm_api_management_certificate.test.thumbprint, | ||
azurerm_api_management_certificate.test.thumbprint, | ||
] | ||
} | ||
} | ||
`, r.template(data, "sf"), data.RandomInteger) | ||
} | ||
|
||
func (r ApiManagementAuthorizationBackendResource) requiresImport(data acceptance.TestData) string { | ||
return fmt.Sprintf(` | ||
%s | ||
|
@@ -364,7 +412,7 @@ resource "azurerm_api_management" "test" { | |
resource_group_name = azurerm_resource_group.test.name | ||
publisher_name = "pub1" | ||
publisher_email = "[email protected]" | ||
sku_name = "Developer_1" | ||
sku_name = "Consumption_0" | ||
} | ||
`, data.RandomInteger, testName, data.Locations.Primary, data.RandomInteger, testName) | ||
} | ||
|
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