Share via

Firewall creation is failing while creating through terraform.

Naveen Vanamadi 5 Reputation points
2024-05-14T17:06:04.9833333+00:00

Firewall deployment is failing through Terraform

Status: "InternalServerError" │ Code: "" │ Message: "An error occurred." │ Activity Id: "" │ │ --- │ │ API Response: │ │ ----[start]---- │ {"status":"Failed","error":{"code":"InternalServerError","message":"An error occurred.","details":[]}} │ -----[end]----- │ │ │   with module.network_landing_zone.azurerm_firewall.firewall, │   on ......\modules\lz\network-lz\resources.tf line 193, in resource "azurerm_firewall" "firewall": │  193: resource "azurerm_firewall" "firewall" {

Azure Firewall
Azure Firewall

An Azure network security service that is used to protect Azure Virtual Network resources.


3 answers

Sort by: Most helpful
  1. Motekaitis, Bronius 0 Reputation points
    2026-04-13T21:06:04.76+00:00

    tldr; Try omitting zones, or setting zones=null.

    I bumped into the following behavior:

    resource "azurerm_firewall" {

    ...
    zones: [1, 2] # bc zone outage in zone 3 in southcentralus
    ...

    which when applied begets the same message that led me to this attempt:

    Deployment of Standard SKU firewall with the specified availability zones is currently not supported in 'southcentralus'. You may retry different availability zones settings or a different SKU / region.

    I did a little googling and came across https://learn.microsoft.com/en-us/azure/firewall/firewall-known-issues#:~:text=Physical%20zone%203%20in%20South%20Central,I%20configure%20availability%20zones%20after%20deployment%3F which states "You can't deploy a new Azure Firewall in zone 3. ... We recommend you deploy a new Azure Firewall to the remaining availability zones or use a different region."

    I did not see a default value for zones property, so I thought, "well, what happens if I leave it null or just remove it altogether?" Et voila! My Az Firewall resource created without a (further) hitch.

    Hope this helps!

    Was this answer helpful?

    0 comments No comments

  2. Naveen Vanamadi 5 Reputation points
    2024-05-22T13:35:59.6866667+00:00

    Just to add, my Terraform configuration contains the multiple resource creation(network resources). So the firewall creation was impacted by VPN Gateway resource creation. Hence I have added depends_on conditions to firewall block for VPN_Gateway which is the fix for this issue.

    Was this answer helpful?

    0 comments No comments

  3. GitaraniSharma-MSFT 50,197 Reputation points Microsoft Employee Moderator
    2024-05-15T13:00:42.7166667+00:00

    Hello @Naveen Vanamadi ,

    I understand that you are trying to deploy an Azure Firewall using Terraform, but it is failing with an InternalServerError message.

    You are trying to deploy an Azure Firewall in East US 2 region and it works fine when you create one through the Azure portal but fails via Terraform.

    I checked internally and found that there is an ongoing issue with few Azure Firewall deployments, where sometimes the Azure Firewall is going into a failed state due to a transient known issue with an underlying Azure Firewall service.

    The Azure Firewall Product Group team is already working on a fix but there is no ETA available as of yet.

    I requested you to create a support request if you need help in recovering the failed Azure Firewall deployment using Terraform, as this will enable the support team to engage with the backend team for further assistance.

    We also offered you a one-time free technical support, in case you don't have a support plan.

    You created a support request for this issue and the support team investigated it from their end. When checking the backend logs, they found an error which mentioned that the VPN gateway is not in provisioning state.

    From the backend error, it seems like you were encountering an issue where the creation of a VPN Gateway was affecting the creation of a Firewall in your Terraform configuration. This can happen if there are dependencies or resource constraints defined in your Terraform code that link these resources together. For example, if you have a firewall policy that specifies routing to be sent over a VPN connection provided by a VPN Gateway, then logically, you cannot create the firewall until after the VPN Gateway is available. Similarly, if there are shared network interfaces or other resources required by both services before they can be created independently.

    So, the support team checked the Terraform code that you shared and found that there is a depends_on variable that is set to depend on subnet, and they asked you to add another depends_on variable and set it to depend on VPN Gateway and then try to deploy Azure Firewall again.

    You added depends_on conditions to the firewall block for VPN_Gateway and this fixed the issue.

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.