Homeglossary

Terraform

Terraform is an infrastructure as code tool that lets teams define, create, change, and track infrastructure through configuration files. It describes the desired end state for cloud resources such as networks, databases, and compute services, then generates a plan to reach it. Terraform commonly uses HashiCorp Configuration Language, or HCL, rather than YAML, and relies on a state record to compare declared infrastructure with deployed resources.

Build cloud-ready apps with Emergent.

What Is Terraform?

Terraform is an infrastructure as code tool from HashiCorp that lets teams define, create, change, and track cloud and on-premises infrastructure through configuration files. Instead of using a cloud console, teams declare the desired end state for networks, databases, and compute services. Terraform uses provider APIs to make the required changes. It provisions infrastructure, while deployment tools release application code.

How Terraform Works: Configuration, Providers, State, and Plans

Terraform uses a workflow that lets teams inspect changes before they happen.

  1. Write configuration, usually in HCL, describing resources and settings.
  2. Run terraform init to download providers and reusable modules.
  3. Run terraform plan to compare configuration and state with live infrastructure.
  4. Review proposed additions, updates, and deletions.
  5. Run terraform apply to make approved changes and update state, which maps declared resources to real ones.

Terraform Configuration Language: HCL, JSON, and YAML

Terraform configuration is usually written in HashiCorp Configuration Language, or HCL. JSON is supported, but YAML is not Terraform's primary configuration language.

FormatTerraform usePractical note
HCLPrimary formatReadable and designed for resources, variables, and expressions.
JSONSupported alternativeUseful for generated files, but often harder to edit.
YAMLNot native configurationCommon in CI/CD tools, not standard Terraform resource files.

Benefits of Terraform

Terraform makes infrastructure changes consistent and reviewable.

  • Configuration can live in version control alongside application code.
  • Plans show intended changes before resources are altered.
  • Reusable modules help teams use the same network pattern across environments.
  • Providers support many cloud platforms through a consistent workflow.
  • Repeated runs help detect and correct configuration drift.

Practical Limits and Risks of Terraform

Terraform automates execution, not technical judgment or security responsibility.

  • State files can contain sensitive identifiers or values and need protected storage and access controls.
  • A mistaken configuration can propose destructive changes, so plans require human review.
  • Provider behavior and cloud APIs can differ, especially for newer services.
  • Shared state requires coordination to prevent conflicting changes.
  • Secrets should be managed carefully rather than committed in plain text.

Terraform vs. Manual Cloud Setup and Imperative Scripts

Each approach has a role, but Terraform is built for repeatable infrastructure.

ApproachBest forMain tradeoff
TerraformRepeatable environments and reviewed infrastructure changesRequires configuration and state management.
Cloud consoleLearning or investigating a serviceManual steps are difficult to reproduce and audit.
Imperative scriptsOne-time operational tasksMust explicitly manage each action and its order.

Terraform in Modern Application Delivery

Terraform commonly works alongside source control, automated tests, and CI/CD pipelines. A team might use it to create a database and network, then deploy the application that uses them. Teams using an AI app builder still need reliable production environments. Emergent helps turn product requirements into full-stack applications, while Terraform can manage infrastructure around an AI web app builder workflow. Build cloud-ready apps with Emergent.

Start Building
on Emergent today
Start Building