ENATIV Logo
ENATIV
Back
© 2026 ENATIV
ProjectsServicesKnowledge hubContact
contact@enativ.pl
  1. Knowledge hub
  2. ›
  3. Cloud & DevOps
  4. ›
  5. Terraform

Terraform

Infrastructure in files: plan, state and providers instead of console clicks, and when I prefer Pulumi.

Cloud & DevOpsUsing since 2022 · Featured project: Gaia Lens (in the Code & Pepper team)

Category
Cloud & DevOps
Using since
2022
Featured project
Gaia Lensin the Code & Pepper team

In practice

I pick Terraform when infrastructure can be described in files and deployed like code, instead of clicked together in a provider console. It is in the stack of CAS Marketplace, Gaia Lens, TPH Global and Kuma.de. For one server with containers its overhead does not pay off.

What is Terraform?

Terraform is an infrastructure as code tool: you describe cloud and on-premises resources in readable configuration files that can be versioned and reused. The configuration is declarative, it describes the end state, and Terraform works out the order and dependencies between resources itself.

It reaches platforms through providers, which let it work with their APIs; those for AWS and Google Cloud sit in the Terraform Registry. Before a change it shows a plan, and after approval it carries the plan out. What it created is recorded in a state file that ties resources to the configuration.

Configuration
Readable files that can be versioned
Model
Declarative, describes the end state
Changes
Plan first, then approval
State
A file that ties resources to the config

How I work with Terraform

I start by asking whether the infrastructure has outgrown clicking by hand. One server with Docker does not need Terraform, several environments and cloud services do.

  1. Configuration in the repository

    I describe resources in files next to the application code and deploy them the same way, with review. Repeating groups of resources go into modules, reusable pieces of configuration.

  2. The plan before a change

    Before every change I read the plan, the list of resources Terraform will create, change or destroy. I check the deletions most carefully, because those are the hardest to undo.

  3. State off the laptop

    By default state sits in a local file, and a remote backend is the better choice, because a local file makes teamwork harder and is easy to lose. I keep state remote and out of the repository, with access for the people who deploy.

When it fits, and when it doesn't

Terraform makes sense where there is enough infrastructure for running it by hand to start hurting.

A good fit when

  • A test and a production environment that should look the same.
  • Infrastructure made of several cloud services that someone must be able to rebuild from scratch.
  • A team where an infrastructure change should go through review like code.
  • A project on several providers or with a possible change of provider.

Not a fit when

  • One VPS with containers in Docker, whose configuration fits in a single file.
  • A prototype that will be thrown away anyway.
  • A team where nobody will take over the state file or read the plans.

When a team prefers to describe infrastructure in TypeScript, I consider Pulumi or AWS CDK. Pulumi and Terraform sit together in the stack of Gaia Lens.

Frequently asked questions

The state file ties the resources in the configuration to what exists at the provider. It sits locally by default, and losing it is a risk that a remote backend reduces. So I keep state remote, outside the repository. Without it Terraform does not know what it already created, so I keep a copy and control access.
Yes, that is the point. The configuration is plain files in a repository that belongs to you, so the next person can read and run it. The description itself depends on the provider, though, because AWS and Google Cloud resources have different types. Moving to another cloud means rewriting the description, not just changing an address.
The configuration stops matching reality. Terraform reads the current state of the resources before a plan, so the difference shows up there and together we decide whether to go back to the file or update the configuration. Rebuilding such fixes from memory is a bad plan, so we agree that changes go through the repository.
First I check what exists and describe the parts that rarely change. I add the other resources one by one and end each step with a plan that shows no changes: a sign that the description matches reality. I do not rewrite everything at once: a mistake in a large change is hard to trace and costly to roll back.

On this page

  • In practice
  • What is Terraform?
  • How I work with Terraform
  • When it fits, and when it doesn't
  • Frequently asked questions

Related topics

  • Terraform
  • AWS
  • Docker
  • Medusa.js
  • PostgreSQL

Is your infrastructure growing faster than your knowledge of it?

List what runs today and how you deploy it. I will answer whether this is the right moment for Terraform or whether a simpler deployment is better.

Describe your projectSee Gaia Lens