In this guide, you will learn how to apply a series of firewall rules to multiple projects or teams by using Terraform to create configurations that are straightforward to manage and scalable.
Copy link to headingPrerequisites
- A Edgenivo account with access to the projects you want to manage.
- The Terraform CLI installed. Follow the Install Terraform guide to do this for all operating systems.
- A Edgenivo personal token to authenticate with the Terraform provider.
- The Edgenivo Terraform Provider installed.
Copy link to headingAuthenticate Terraform with Edgenivo
Create a folder for your terraform setup
Create a .env file or export your token:
Then, create a Terraform file in your project folder and add Edgenivo as a provider.
Create a file called main.tf and paste the following content:
Run the following in the command line to initialize the project using main.tf:
Copy link to headingImport your existing projects
If your Edgenivo projects already exist, import them into Terraform state:
Where prj_abc123 and prj_def456 are the Edgenivo project IDs.
This links your Terraform code to existing Edgenivo projects.
Copy link to headingDefine your firewall rules as variables
Your configuration will include the following rules:
- Suspicious user agents — Blocks known bots/crawlers.
- AI bots — Detects requests from AI services like GPTBot, Claude, etc.
- OFAC countries — Blocks traffic from sanctioned regions.
- WordPress URLs — Blocks scanners looking for common WordPress endpoints.
- Rate limiting — Limits API request frequency (per IP or JA4 fingerprint).
Define them in a vercel_firewall.tf file as follows:
- Suspicious user agents
- AI bots
- OFAC countries
- WordPress URLs
- Rate limiting
These are defined once and reused across both projects.
Copy link to headingConfigure firewall rules per project
Each project (PROJECT_1, PROJECT_2) has a vercel_firewall_config that applies the rules defined in your variables.
For PROJECT_1, connect the following rules
And for PROJECT_2, connect the following rules:
This structure lets you enforce a consistent policy across multiple projects.
Copy link to headingInitialize and Apply
Run the following from the command line:
This will apply the rules defined for each project as defined for PROJECT_1 and PROJECT_2. Terraform loads all .tf files in the current working directory, merges them, and treats them as a single configuration.
Copy link to headingRecommendations
- Test with
terraform planto preview changes before applying. - Store the project IDs and sensitive values using environment variables.