Skip to content
Nubent

/Glossary · DevOps

What is Terraform?

Terraform is an infrastructure as code tool from HashiCorp that defines cloud resources in declarative HCL files and creates, updates or deletes them based on a plan. It works with AWS and hundreds of other providers.

How Terraform works

You write the configuration in HCL, run terraform plan to see what will change and terraform apply to make it happen. Terraform keeps a state file that maps each resource in your code to its real identifier in AWS, and uses it to compute differences and the correct creation order based on dependencies.

Providers translate the configuration into API calls; the AWS provider covers practically every service. Modules group resources into reusable building blocks, such as a standard VPC or an ECS service with its load balancer, and are versioned so each team consumes them in a controlled way.

When to use Terraform

Terraform is a good fit when you want a single language for AWS and for other services like GitHub, Cloudflare or Datadog, or when your team already knows it. It also has plenty of maintained modules and quality tooling, which speeds up building a landing zone or an internal platform.

Since 2023 Terraform has used the Business Source License, and OpenTofu exists as an open source alternative under the Linux Foundation, compatible with most configurations. For most teams using Terraform internally the license changes nothing, but it is worth knowing the option is there.

Best practices and common mistakes on AWS

Store state in an S3 bucket with versioning and encryption, and use native locking with use_lockfile, available since Terraform 1.10, which replaces DynamoDB-based locking. Split state by environment and by component, pin provider and module versions, and run changes from a pipeline with plan review.

Common mistakes: keeping state locally or in the repository, committing secrets in variable files, using a single state for everything, and applying changes from someone's laptop with admin permissions. Another is overusing workspaces to separate environments that really should live in separate accounts.

/FAQ

Questions about Terraform

Another question? Write to hello@nubent.com and an engineer will answer.

Is Terraform free?

The Terraform CLI can be used at no cost under the Business Source License for internal use. HCP Terraform, HashiCorp's managed service, has paid plans with collaboration and governance features. OpenTofu is a compatible open source alternative.

Where should Terraform state be stored on AWS?

The recommended setup is an S3 bucket with versioning, encryption and restricted access, using native S3 locking through use_lockfile. That way several people or pipelines can work without stepping on each other and recover earlier state versions if something goes wrong.

What is the difference between Terraform and OpenTofu?

OpenTofu started as a fork of Terraform when HashiCorp changed the license in 2023. It is open source, maintained by the Linux Foundation and compatible with most configurations and providers, although both projects now add features of their own.

Next step

What should we build next on AWS?

30 minutes with an engineer. Concrete next steps, whether or not you work with us.