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.
580 questions
{count} votes

2 answers

Sort by: Most helpful
  1. GitaraniSharma-MSFT 48,016 Reputation points Microsoft Employee
    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.

    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.

    0 comments No comments