Problem
When creating a private_endpoint
to a static webapp in Australia east region using terraform, you may get this error :
Performing CreateOrUpdateStaticSite:
│ unexpected status 400 (400 Bad Request) with error:
│ LocationNotAvailableForResourceType: The provided location ‘australiaeast’
│ is not available for resource type 'Microsoft.Web/staticSites'. List of
│ available regions for the resource type is 'westus2,centralus,eastus2,westeurope,eastasia'.
However, creating a private endpoint through the Azure Portal in the same region works fine.
Cause
This error occurs as we not provide the value of an optional attribute called subresource_names
under the private_service_connection
block. As per our documentation:
subresource_names is a list of subresource names which the Private Endpoint is able to connect to and corresponds to group_id.
Possible values are listed in the Microsoft documentation. For static sites, we need to use the sub-resources as staticSites
Solution
Update the configuration for the resource azurerm_private_endpoint
as below to create the private_endpoint in the Australia east region:
resource "azurerm_private_endpoint" "static_web_app_endpt" {
name = "testswa-pe" #name of the private endpoint
location = "Australia East" #location of private endpoint
resource_group_name = "test-rg" #name of the rg where azurerm_static_web_app is listed
subnet_id = azurerm_subnet.endpoint.id
private_service_connection {
name = "testswarg-psc" #name of private service connection
private_connection_resource_id = azurerm_static_web_app.static_site.id
subresource_names = ["staticSites"]
is_manual_connection = false
}
Note: If you continue to experience issues, please contact HashiCorp Support.