IaC: What, Me Cluster?
Saturday, July 11, 2026Abstract
Decoupling the SRX cluster. Replacing Juniper SRX chassis clusters with standalone nodes and declarative Infrastructure as Code (IaC).
The Low-Down
High-availability firewall design was supposed to be simple: take two identical SRXs and cluster them together. A Juniper cluster ties two nodes together with a control and fabric link. It provides one management plane and a stateful failover.
It looks darn good on paper. For example, its ISSU was sold as a system that never goes down during patching. In reality, a small hiccup can turn a simple update into a pants-on-fire split-brain event.
If I could do it all over again I might have chosen a boring alternative. Ditch the cluster. Run independent nodes and lean hard on dynamic routing and Infrastructure as Code (IaC). Let BGP (or OSPF) handle all failover. Use OpenTofu or Terraform as the external control plane so security policy stays in sync among both nodes. No shared control plane. No reth interfaces. Maintenance becomes a dream. If one blows up during patching? So what? 🤣 The other node carries the load. No sweat. No drama . All by design.
Standalone pair + dynamic routing
Live and die by dynamic routing. And why not? It’s time proven for over 30 years. It just works. Frankly, it’s intuitive. Traffic steering lives in the routing protocol. You want traffic to exit node0? Give it local preference 300. You want it to default out node1? Give node0 the default preference and node1 preference 300. Boom!💥
Granted, you lose stateful session connection tracking during failover. But 1997 called, and they want their session-dependent apps back! Most web and cookie/token-based traffic barely notice a disruption. The next transit request arrives on the next node with a fresh binding. Nearly seamless to the end user. Perhaps a 10-second delay at most.
External control plane
That single management plane is nice... while it lasts. But it only works for two-node clusters. It still leaves every other firewall, router, and switch to fend for themselves. It's not rainbows and unicorns.
However, there is one CLI to rule them all. Say hello to my little friend, OpenTofu (i.e., Terraform).
It's darn near the holy grail of management. Git for version control and an audit trail. A validation step before anything touches a node. And an orchestrator that can push the same stanza to every device you manage. You edit the security policy once. The change lands on both SRXs. The nodes are not clustered! It's a single management pane for unlimited nodes. 😉
The Git repo can live wherever you prefer. A small server on an isolated management network works fine. Or you can use GitHub, Azure DevOps, or whatever cloud service you already trust. Either way the workflow is the same: branch, edit, pull request.
A policy change in practice
Say you need to open SSH from a new jump-box subnet. You edit the HCL instead of the CLI:
variable "firewalls" {
type = map(object({
host_ip = string
untrust_ip = string
}))
default = {
"srx-node1" = { host_ip = "10.10.0.11", untrust_ip = "203.0.113.10/30" }
"srx-node2" = { host_ip = "10.10.0.12", untrust_ip = "203.0.113.14/30" }
}
}
resource "junos_security_zone" "trust" {
for_each = var.firewalls
name = "TRUST"
inbound_services = ["ssh", "ping"]
}
resource "junos_security_zone" "untrust" {
for_each = var.firewalls
name = "UNTRUST"
}
resource "junos_security_policy" "mgmt_access" {
for_each = var.firewalls
from_zone = junos_security_zone.untrust[each.key].name
to_zone = junos_security_zone.trust[each.key].name
policy {
name = "ALLOW-JUMPBOX"
match_source_address = ["10.250.0.0/24"]
match_destination_address = ["any"]
match_application = ["junos-ssh"]
then = "permit"
}
}
Commit it, open a PR, and let someone else validate your work. Then:
tofu plan
You should see the identical delta for both nodes. Only after that does the apply run. OpenTofu opens NETCONF to both boxes, commits the candidate, and finishes. Both SRXs now have the same policy. If someone later hand-edits one of them, the next plan calls it out.
But wait, there’s more! The same methodology works for the rest of the fleet. All the firewalls. All the routers. All the switches. One repo, one plan, one apply. You become the white wizard. 🤣
Benefits
Configuration drift shows up instead of hiding until something breaks. Git becomes the audit trail. Reverting a bad change on both firewalls is a revert plus an apply. Upgrades and hardware failures no longer risk taking the whole cluster down. Failover is simple BGP logic.
Honest limits
You traded firewall session synchronization for independence. Pure long-lived TCP flows can still break (and the immediately reestablish). Most web and cookie/token traffic barely notice. The next request arrives on the surviving node with a fresh NAT binding. The application session stays intact. BGP convergence takes a few seconds, not sub-second. The Junos Terraform provider covers most everything, but some features are still easier with a CLI command, a targeted NETCONF call, or an Ansible playbook. NAT and return-path symmetry still require deliberate packet flow.
None of that makes the system wrong. It a trade-off: standalone hardware, routed failover, and consistent policy instead of a fragile shared control plane.
That's all Folks!

0 Comments:
Post a Comment