Vagrant

What is the difference between Vagrant and Terraform?

Answer:

Vagrant and Terraform are both built by HashiCorp, but they work at different layers: Vagrant spins up a disposable virtual machine on your laptop for local development, while Terraform declares and manages real cloud infrastructure across providers. They aren't two options for the same job, and teams running a HashiCorp-heavy toolchain often end up using both, just for different things.

AspectVagrantTerraform
LayerLocal development machineCloud infrastructure
Typical targetA VM via VirtualBox, Docker, or another providerCompute, networking, DNS, and other resources on AWS, Azure, GCP, and others
Config fileVagrantfile (Ruby-based DSL).tf files (HCL)
State trackingNone beyond the running VM itselfA state file mapping config to deployed resources
Typical lifecyclevagrant up / halt / destroy, rebuilt oftenterraform plan / apply, changes tracked and meant to persist

When should you use Vagrant?

Reach for Vagrant when you want every developer on a team to work in an identical environment without touching anything resembling production. A Vagrantfile boots a VM with a known OS, tools, and dependencies preinstalled, so a new hire runs one command instead of following a setup document. It's meant to be disposable: if the environment drifts or breaks, you destroy it and rebuild rather than debug it in place.

When should you use Terraform?

Reach for Terraform when you're provisioning anything other systems or people depend on: staging or production servers, load balancers, DNS records, managed databases. Terraform writes the desired end state to a state file and calculates the diff needed to reach it, which is what makes it usable for infrastructure that has to survive between runs and stay consistent across a team through version control.

There's a related question on this site, "Vagrant vs Terraform: which is better for environment provisioning?", worth checking if you're choosing between the two for a specific project rather than trying to understand what each one does.

Who fits what?

If you're onboarding developers and want consistent local setups, Vagrant is the right layer. If you're standing up or changing cloud resources that need to persist and be auditable, that's Terraform's job. In practice the two often sit side by side: Vagrant for the laptop, Terraform for everything that laptop eventually talks to.

Curved left line
We're Here to Help

Thinking about how to expand a tech team flexibly to adapt to different working paces?

Accelerate development, meet launch deadlines with flexible, much-needed capacity. Add new skills your team currently lacks.

Curved right line