Created
February 17, 2022 08:52
-
-
Save magodo/c45fbf9a097c2a695d10151741c654a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "azurerm" { | |
features {} | |
} | |
resource "azurerm_resource_group" "test" { | |
name = "fwpolicy-test" | |
location = "westeurope" | |
} | |
resource "azurerm_public_ip" "test" { | |
name = "fwpolicy-test" | |
resource_group_name = azurerm_resource_group.test.name | |
location = azurerm_resource_group.test.location | |
allocation_method = "Static" | |
} | |
resource "azurerm_firewall_policy" "firewallpolicy" { | |
name = "test-firewall-uksouth-policy" | |
resource_group_name = azurerm_resource_group.test.name | |
location = azurerm_resource_group.test.location | |
} | |
# Policy rule collection groups | |
resource "azurerm_firewall_policy_rule_collection_group" "policycollectiongroup" { | |
name = "test-firewall-uksouth-policy-rcg" | |
firewall_policy_id = azurerm_firewall_policy.firewallpolicy.id | |
priority = 500 | |
application_rule_collection { | |
name = "app_rule_collection1" | |
priority = 500 | |
action = "Deny" | |
rule { | |
name = "app_rule_collection1_rule1" | |
protocols { | |
type = "Http" | |
port = 80 | |
} | |
protocols { | |
type = "Https" | |
port = 443 | |
} | |
source_addresses = ["10.0.0.1"] | |
destination_fqdns = ["*.microsoft.com"] | |
} | |
} | |
network_rule_collection { | |
name = "network_rule_collection1" | |
priority = 400 | |
action = "Deny" | |
rule { | |
name = "network_rule_collection1_rule1" | |
protocols = ["TCP", "UDP"] | |
source_addresses = ["10.0.0.1"] | |
destination_addresses = ["192.168.1.1", "192.168.1.2"] | |
destination_ports = ["80", "1000-2000"] | |
} | |
} | |
nat_rule_collection { | |
name = "nat_rule_collection1" | |
priority = 300 | |
action = "Dnat" | |
rule { | |
name = "nat_rule_collection1_rule1" | |
protocols = ["TCP", "UDP"] | |
source_addresses = ["10.0.0.1", "10.0.0.2"] | |
destination_address = azurerm_public_ip.test.ip_address | |
destination_ports = ["80"] | |
translated_address = "192.168.0.1" | |
translated_port = "8080" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment