Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (13.1k points)

I was trying to create a firewall using Terraform HCL and it was throwing an error:

Code="AzureFirewallPublicIPNotStandard" Message="AzureFirewall fwMyTest references a non standard Public IP Address

Can anyone help me with this? Any help can be appreciated!

1 Answer

0 votes
by (26.7k points)

So basically, the SKU which you are setting it to Standard. What Azure prefer is the SKU of Public IP should match with SKU of load balancer. And both should be set it on Basic. Below is the code:

#Create public ip for load balancer

resource "azurerm_public_ip" "#{application}##{vertical}#PublicIPforLB" {

    name = "lbip#{application}##{vertical}#"

    location = azurerm_resource_group.#{application}##{vertical}#ResourceGroup.location

    resource_group_name = azurerm_resource_group.#{application}##{vertical}#ResourceGroup.name

    allocation_method = "Static"

    sku = "Standard"

}

#Create load balancer for 2 front-end web server VMs

resource "azurerm_lb" "#{application}##{vertical}#LoadBalancer" {

    name = "lb#{application}##{vertical}#"

    location = azurerm_resource_group.#{application}##{vertical}#ResourceGroup.location

    resource_group_name = azurerm_resource_group.#{application}##{vertical}#ResourceGroup.name

    sku = "Standard"

    frontend_ip_configuration {

        name = "ipconfLB"

        public_ip_address_id = azurerm_public_ip.#{application}##{vertical}#PublicIPforLB.id

    }

}

I hope this will help.

Want to become an Azure expert? join azure architect certification now!!

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...