The Simplest Way to Make Fortigate and Pulumi Work Like They Should
Using fortigate and pulumi together lets teams automate firewall rules with standard code. Pulumi sends change requests to the FortiGate API to update network paths. Manual firewall changes take too much time and often cause outages. Writing network rules in code stops human error and leaves a clear history. Every subnet, address group, and port rule lives in version control. Reviewers check the changes in a pull request before any rule goes live. Once approved, the automation tool applies the
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Using fortigate and pulumi together lets teams automate firewall rules with standard code. Pulumi sends change requests to the FortiGate API to update network paths.
Manual firewall changes take too much time and often cause outages. Writing network rules in code stops human error and leaves a clear history. Every subnet, address group, and port rule lives in version control. Reviewers check the changes in a pull request before any rule goes live. Once approved, the automation tool applies the update to the firewall right away.
How fortigate and pulumi share permissions and state
Pulumi talks to the FortiGate appliance over a secure web interface. The firewall exposes an API that accepts requests to read or write rules. You set up an API admin account on the firewall for this task. That account gives you a secret token to log in from your runner. Pulumi stores this token in its encrypted secret store before a run starts.
During a run, Pulumi reads the current state file to see past settings. It also queries the firewall to check the live network rules right now. Next, it compares the live firewall settings against your desired code definitions. If a port or address differs, the tool builds a plan to fix it. Once you approve the plan, Pulumi sends write requests to the firewall API. The firewall applies the new rule and sends back a success message. Finally, Pulumi updates its state file to match the new firewall setup.
Common mistakes when linking code to network appliances
Many teams fail because they give the automation tool full admin rights. A shared root key can wipe out core routing if code has a bug. Instead, create a tight admin profile on the firewall for your runner. Give the role write rights only for the specific virtual domain it manages. Block the token from changing system admins, audit settings, or core interfaces.
Another big risk comes from opening the firewall management port to the internet. Cloud runners need a way to reach the appliance during a deployment. Do not expose the admin interface to public IP addresses for this step. Run your deployment agent inside your private network close to the firewall. Restrict the API user to accept calls only from that internal runner subnet.
Pulumi Policy as Code + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
State files can also leak private network details if you leave them open. A state file holds IP ranges, admin tokens, and internal routing maps. Always turn on secret encryption in your project before you run any updates. Store the state file in a locked backend with strict role checks. Keep an eye on firewall logs to see every call the token makes. If a run fails, check the log to see which rule broke first. Good scoping and clean logs keep your network safe during fast code runs.
Keeping manual edits from breaking your code state
Network engineers sometimes log into the firewall screen during an urgent night outage. They add a quick rule by hand to fix a broken app. The next day, the code runner knows nothing about this manual fix. If you run an update, the tool might delete that urgent rule. Teams call this problem state drift, and it breaks production setups fast.
To prevent drift, lock down human accounts to read-only roles in normal hours. Make all daily rule updates go through your code repo and review flow. Run a scheduled check job every morning to spot any surprise changes. This job compares the firewall against your code without writing any new data. If the check spots a manual edit, it alerts the network team fast. Engineers can then import the manual rule into code so both sides match.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
How does Pulumi talk to a FortiGate firewall?
Pulumi uses a provider plugin that sends HTTPS requests to the FortiGate REST API. It logs in with an API token and updates rules based on your code.
What happens if someone changes a firewall rule by hand?
Manual edits create drift between the live firewall and the saved Pulumi state file. You must refresh the state file or overwrite the manual edit on the next run.
How should we restrict the FortiGate API user for automation?
Assign a custom profile with read and write rights only for needed rule tables. Lock the API user to accept traffic only from your runner IP address.
Related guides
In this post