Terraform for Network Engineers: Automating Cloud and Network Infrastructure with IaC
Conxiea
29 August 2026
→ See How Conxiea's AI InfraOps Platform Automates Network and Cloud Operations
Clicking through a cloud console to build a VPC works fine for a lab. It falls apart fast in production: no audit trail beyond the platform's own logs, no easy way to replicate the environment, and no protection against someone making an undocumented change that nobody else knows about until something breaks.
Terraform solves this by letting you define infrastructure in code, review changes before they happen, and apply them consistently. For network engineers moving into cloud automation, it's the tool that turns the cloud networking concepts you've already learned into something repeatable and reviewable.
This post is part of our complete roadmap for network engineers moving into network automation and cloud automation. If you're mapping out the full path, start there. If you haven't covered cloud networking fundamentals yet, our guide to VPCs, VNets, and cloud routing is the natural prerequisite.
Dark, moody laptop screen showing infrastructure-as-code Terraform configuration
What Infrastructure as Code Actually Means
Infrastructure as code means describing the infrastructure you want, a VPC, a set of subnets, a route table, in a file, and having a tool read that file and make the real infrastructure match it. The file becomes the source of truth. If the file says three subnets and the cloud environment only has two, running the tool creates the missing one. If someone manually deletes a resource the file still describes, running the tool recreates it.
This is a direct extension of a concept network engineers already understand from configuration management: defining intended state and using automation to enforce it. Terraform applies that same principle to cloud infrastructure rather than device configuration.
Why Terraform Specifically
Terraform isn't the only infrastructure-as-code tool, AWS has CloudFormation, Azure has Bicep, but it's the one that works consistently across every major cloud provider through the same language and workflow. For network engineers who may end up working across AWS, Azure, and GCP, or building hybrid architectures that span more than one, that provider-agnostic consistency is a real practical advantage. Learn Terraform once and the same mental model, the same commands, the same workflow, applies regardless of which cloud you're pointed at.
Core Concepts
HCL (HashiCorp Configuration Language) is Terraform's syntax, a declarative language designed to be readable without needing a programming background. A block defining an AWS subnet looks close to plain description: resource type, a name, and a set of arguments like CIDR block and availability zone.
Providers are plugins that let Terraform talk to a specific platform, AWS, Azure, GCP, and hundreds of others. Declaring a provider tells Terraform which API to use and handles authentication.
Resources are the individual pieces of infrastructure you're defining, a VPC, a subnet, a route table, a security group. Each resource block maps to something Terraform will actually create, modify, or destroy in the real environment.
State is how Terraform tracks what it has already created, stored in a state file that maps your configuration to real-world resource IDs. This is the part that trips people up initially: Terraform's understanding of reality depends entirely on that state file staying accurate, which is why state is typically stored remotely and shared, not left on someone's laptop.
Plan and apply is the core workflow. Running terraform plan shows exactly what would change, additions, modifications, deletions, without touching anything. Running terraform apply executes those changes. That plan step is the single biggest safety improvement over clicking through a console: you see the blast radius of a change before it happens, every time.
A First Real Module: A Basic VPC
The fastest way to make these concepts concrete is building something small and real. A first Terraform project worth building: a VPC with two public subnets across two availability zones, an internet gateway, and a route table associating the subnets with it. It's small enough to finish quickly and touches almost every core concept, resources, providers, dependencies between resources, and the plan/apply workflow.
Once that works, extend it: add a variable for the CIDR block instead of hardcoding it, so the same module can be reused for different environments. That single change introduces the concept of Terraform modules, reusable, parameterised blocks of infrastructure definition, which is how real Terraform codebases stay maintainable as they grow past a handful of resources.
Terraform vs Ansible: Different Jobs, Not Competing Tools
A common point of confusion for network engineers new to both tools: Terraform and Ansible aren't really competitors, despite both being automation tools with some surface-level overlap.
| Terraform | Ansible | |
|---|---|---|
| Best for | Provisioning infrastructure (create, modify, destroy) | Configuring existing infrastructure and devices |
| Model | Declarative, tracks state | Procedural, executes tasks in order |
| Typical use in networking | Building VPCs, subnets, cloud gateways | Pushing config to switches, routers, firewalls |
In practice, they're often used together: Terraform provisions the cloud infrastructure, VPCs, subnets, gateways, and Ansible configures what runs inside it or manages the on-prem network devices connecting to it. Our comparison of Ansible and Terraform for network automation goes deeper into where each tool fits.
Integrating Terraform into a CI/CD Pipeline
Running terraform apply from a laptop works for learning. Production use puts Terraform behind a pipeline: a change gets proposed as a pull request, terraform plan runs automatically and posts the output for review, a human approves it, and only then does terraform apply run, typically from the pipeline itself rather than anyone's local machine.
This is the point where infrastructure as code stops being a personal productivity tool and becomes an organisational discipline: every infrastructure change is reviewed, logged, and reversible through version control, the same rigour software teams apply to application code, now applied to network and cloud infrastructure. This is also the foundation of what the next stage of the roadmap, NetDevOps, is actually built on.
Common Mistakes
Storing state locally. A state file on one engineer's laptop is a single point of failure and makes team collaboration close to impossible. Use remote state (an S3 bucket with locking, Terraform Cloud, or equivalent) from the start, even on solo projects, to build the right habit.
Making manual changes alongside Terraform-managed infrastructure. Once a resource is managed by Terraform, manual changes through the console create drift that the next apply will either fight against or silently overwrite. Pick one source of truth per resource and stick to it.
Skipping the plan step. Running apply without reviewing plan first defeats the entire safety benefit of using Terraform in the first place. Get in the habit of reading the plan output properly, every time, even when you're confident you know what it'll say.
Want to see Terraform and network automation working together at production scale?
At Conxiea, infrastructure as code is core to how we build and operate client networks and cloud environments through our AI InfraOps platform.
No obligations. Whether you're a business modernising your infrastructure or an engineer building these skills, we're happy to talk it through.
Related Reading
- Network Automation and Cloud Automation: The Complete Career Roadmap for Network Engineers
- Cloud Networking Fundamentals for Network Engineers
- Ansible vs Terraform for Network Automation: An Honest Comparison
- NetDevOps Explained: How Network Engineers Become Network Automation Engineers
- Python for Network Engineers: The Practical Skills You Need for Network Automation