(for anyone who might be using the Hashicorp/Microsoft Azure CAF Module for enterprise infrastructure as code)
Azure provides a terraform module for implementing enterprise landing zones using infrastructure-as-code/data-as-code paradigm:
https://github.com/Azure/terraform-azurerm-caf-enterprise-scale
However there is no indication or documentation on how to manage Azure Firewall Policies and Rules using the module (but deploy of AFW is possible).
Has anyone done this using the module (or should I consider doing it using a separate module) ?
2
Answers
In this part of the documentation have information related to Azure Firewall configuration
So first of all, Azure CAF (aztfmod) and Terraform enterprise scale are two different solutions. This Azure Landing Zone Comparison blog post explain the difference.
When you say you want to deploy firewall rules, I assume you want to deploy a azurerm_firewall_policy_rule_collection_group, i.e. rules based on IP, Port, Protocol etc.
Terraform Enterprise scale
Does not include support for deploying these fine grained
firewall_policy_rule_collection_group
. You can however configureazurerm_firewall_policy
via the exposed variables described here.If you want to deploy a
firewall_policy_rule_collection_group
your best bet is to deploy that in your own module and connect it to the policy deployed by the enterprise scale module viafirewall_policy_id
.Aztfmod
In aztfmod, there’s two places firewall rules come into place, depending on which Level of Azure CAF modules you’re targeting
Here’s an example how to configure the hub firewall rules in level 2
examples/networking/firewall/103-firewall-policies/configuration.tfvars
In general this seems to be closer to what you want.
Some caveat about both Microsoft Landing Zone approaches here.
Doing the integration between level 2 and 3 (in aztfmod language) is quite a bit complex and from my experience and can quickly become hard to keep track of doing manually which rules belong to which spoke. Consider implementing an automated (or at least semi-automated) virtual network self-service for spoke networks. This service can then build the firewall rule group variables for aztfmod dynamically for example.