azurermFirewallNetworkRuleCollection
Manages a Network Rule Collection within 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");
const azurermFirewallNetworkRuleCollectionExample =
new azurerm.firewallNetworkRuleCollection.FirewallNetworkRuleCollection(
this,
"example_5",
{
action: "Allow",
azure_firewall_name: azurermFirewallExample.name,
name: "testcollection",
priority: 100,
resource_group_name: azurermResourceGroupExample.name,
rule: [
{
destination_addresses: ["8.8.8.8", "8.8.4.4"],
destination_ports: ["53"],
name: "testrule",
protocols: ["TCP", "UDP"],
source_addresses: ["10.0.0.0/16"],
},
],
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermFirewallNetworkRuleCollectionExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the Network Rule Collection which must be unique within the Firewall. Changing this forces a new resource to be created. -
azureFirewallName
- (Required) Specifies the name of the Firewall in which the Network Rule Collection should be created. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) Specifies the name of the Resource Group in which the Firewall exists. Changing this forces a new resource to be created. -
priority
- (Required) Specifies the priority of the rule collection. Possible values are between100
-65000
. -
action
- (Required) Specifies the action the rule will apply to matching traffic. Possible values areallow
anddeny
. -
rule
- (Required) One or morerule
blocks as defined below.
A rule
block supports the following:
-
name
- (Required) Specifies the name of the rule. -
description
- (Optional) Specifies a description for the rule. -
sourceAddresses
- (Optional) A list of source IP addresses and/or IP ranges. -
sourceIpGroups
- (Optional) A list of IP Group IDs for the rule.
-> NOTE At least one of sourceAddresses
and sourceIpGroups
must be specified for a rule.
-
destinationAddresses
- (Optional) Either a list of destination IP addresses and/or IP ranges, or a list of destination Service Tags. -
destinationIpGroups
- (Optional) A list of destination IP Group IDs for the rule. -
destinationFqdns
- (Optional) A list of destination FQDNS for the rule.
-> NOTE You must enable DNS Proxy to use FQDNs in your network rules.
-> NOTE At least one of destinationAddresses
, destinationIpGroups
and destinationFqdns
must be specified for a rule.
-
destinationPorts
- (Required) A list of destination ports. -
protocols
- (Required) A list of protocols. Possible values areany
,icmp
,tcp
andudp
.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Firewall Network Rule Collection.update
- (Defaults to 30 minutes) Used when updating the Firewall Network Rule Collection.read
- (Defaults to 5 minutes) Used when retrieving the Firewall Network Rule Collection.delete
- (Defaults to 30 minutes) Used when deleting the Firewall Network Rule Collection.
Import
Azure Firewall Network Rule Collections can be imported using the resourceId
, e.g.