The Terraform provider for PAN-OS enables you to automate the configuration of a Palo Alto Networks next-generation firewall that has been deployed in either a virtualized environment or on a physical network. In the public cloud, users can automate the creation of a VPC or Resource Group that contains a VM-Series firewall using an AWS, Google Cloud or Azure provider. Using the PAN-OS provider, they can then apply the VM-Series configuration, effectively performing end-to-end deployment automation. Let’s walk through an example of how you might use the Terraform provider for PAN-OS.
Whether another provider has been used to deploy the VM-Series or the firewall is physical, let's assume that the firewall is accessible. We now want to configure two ethernet interfaces on the firewall: ethernet1/1 in a L3-trust zone that allows pings, and ethernet1/2 in a L3-untrust zone. Both interfaces will use DHCP to get their IP addresses. We'll do all of this in vsys1.
First we'll need to configure the provider connection to the VM-Series. The full documentation for the provider can be foundhere.
There are only three parameters that are required to configure the provider: the hostname, username, and password. So, let's start out our Terraform plan file with just our provider config like so:
In our example, I'm following best practices of creating a separate user account named "terraform". Functionally, there is no reason that you couldn't use the "admin" account to do this but do so only for proof of concepts. This way, when Terraform is running, this separate account will appear in the Active Sessions dashboard in the GUI, informing you that Terraform is making changes.
Interface Management Profile Configuration
Now that we've specified our authentication info, let's go ahead and configure the interface management profile that we want our internal interface to use. The full documentation for interface management profiles can be foundhere.
Based on the documentation for interface management profiles, we can now configure it like so:
Next up is our two interfaces. The full documentation for ethernet interfaces can be foundhere.
Using the interface documentation, we can now configure our two ethernet interfaces. For our example, let's say that we want to configure ethernet1/1 as the internal interface and ethernet1/2 as the external interface. We need to apply our interface management profile to the internal interface to enable the services we want, which means that the interface management profile needs to be created first. To make this happen, we'll refer to our management profile via its Terraform variable name instead of using the string "Allow ping". So the configuration will look like this:
Now we need to create our two security zones. The full documentation for security zones can be found here.
Just like with the data interfaces, we will want to refer to the interfaces via their Terraform variable names to signal to Terraform that we want the interfaces to be created before the security zones are created. Since "vsys1" is assumed if it isn't present, we don't need to specify it. Thus, the security zone configuration will look like this:
The Terraform provider for PAN-OS allows users to embed next generation security into their multi-cloud application deployment lifecycle, eliminating potential security roadblocks that may occur as developers add or remove workloads.
Here's the full configuration including provider, interface management profile, ethernet interface, and zone configurations: