Skip to content

azurermFirewall

Manages an Azure Firewall.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_1",
  {
    address_space: ["10.0.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "testvnet",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermPublicIpExample = new azurerm.publicIp.PublicIp(
  this,
  "example_2",
  {
    allocation_method: "Static",
    location: azurermResourceGroupExample.location,
    name: "testpip",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPublicIpExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_3", {
  address_prefixes: ["10.0.1.0/24"],
  name: "AzureFirewallSubnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermFirewallExample = new azurerm.firewall.Firewall(
  this,
  "example_4",
  {
    ip_configuration: [
      {
        name: "configuration",
        public_ip_address_id: azurermPublicIpExample.id,
        subnet_id: azurermSubnetExample.id,
      },
    ],
    location: azurermResourceGroupExample.location,
    name: "testfirewall",
    resource_group_name: azurermResourceGroupExample.name,
    sku_name: "AZFW_VNet",
    sku_tier: "Standard",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermFirewallExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Firewall. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • skuName - (Required) SKU name of the Firewall. Possible values are azfwHub and azfwVNet. Changing this forces a new resource to be created.

  • skuTier - (Required) SKU tier of the Firewall. Possible values are premium, standard and basic.

  • firewallPolicyId - (Optional) The ID of the Firewall Policy applied to this Firewall.

  • ipConfiguration - (Optional) An ipConfiguration block as documented below.

  • dnsServers - (Optional) A list of DNS servers that the Azure Firewall will direct DNS traffic to the for name resolution.

  • privateIpRanges - (Optional) A list of SNAT private CIDR IP ranges, or the special string ianaPrivateRanges, which indicates Azure Firewall does not SNAT when the destination IP address is a private range per IANA RFC 1918.

  • managementIpConfiguration - (Optional) A managementIpConfiguration block as documented below, which allows force-tunnelling of traffic to be performed by the firewall. Adding or removing this block or changing the subnetId in an existing block forces a new resource to be created. Changing this forces a new resource to be created.

  • threatIntelMode - (Optional) The operation mode for threat intelligence-based filtering. Possible values are: off, alert and deny. Defaults to alert.

  • virtualHub - (Optional) A virtualHub block as documented below.

  • zones - (Optional) Specifies a list of Availability Zones in which this Azure Firewall should be located. Changing this forces a new Azure Firewall to be created.

-> Please Note: Availability Zones are only supported in several regions at this time.

  • tags - (Optional) A mapping of tags to assign to the resource.

An ipConfiguration block supports the following:

  • name - (Required) Specifies the name of the IP Configuration.

  • subnetId - (Optional) Reference to the subnet associated with the IP Configuration. Changing this forces a new resource to be created.

-> NOTE The Subnet used for the Firewall must have the name azureFirewallSubnet and the subnet mask must be at least a /26.

-> NOTE At least one and only one ipConfiguration block may contain a subnetId.

  • publicIpAddressId - (Required) The ID of the Public IP Address associated with the firewall.

-> NOTE The Public IP must have a static allocation and standard SKU.


A managementIpConfiguration block supports the following:

  • name - (Required) Specifies the name of the IP Configuration.

  • subnetId - (Required) Reference to the subnet associated with the IP Configuration. Changing this forces a new resource to be created.

-> NOTE The Management Subnet used for the Firewall must have the name azureFirewallManagementSubnet and the subnet mask must be at least a /26.

  • publicIpAddressId - (Required) The ID of the Public IP Address associated with the firewall.

-> NOTE The Public IP must have a static allocation and standard SKU.


A virtualHub block supports the following:

  • virtualHubId - (Required) Specifies the ID of the Virtual Hub where the Firewall resides in.

  • publicIpCount - (Optional) Specifies the number of public IPs to assign to the Firewall. Defaults to 1.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Azure Firewall.

  • ipConfiguration - A ipConfiguration block as defined below.

  • virtualHub - A virtualHub block as defined below.


A ipConfiguration block exports the following:

  • privateIpAddress - The Private IP address of the Azure Firewall.

A virtualHub block exports the following:

  • privateIpAddress - The private IP address associated with the Firewall.

  • publicIpAddresses - The list of public IP addresses associated with the Firewall.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 90 minutes) Used when creating the Firewall.
  • update - (Defaults to 90 minutes) Used when updating the Firewall.
  • read - (Defaults to 5 minutes) Used when retrieving the Firewall.
  • delete - (Defaults to 90 minutes) Used when deleting the Firewall.

Import

Azure Firewalls can be imported using the resourceId, e.g.

terraform import azurerm_firewall.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/azureFirewalls/testfirewall