Terraform
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.
- Write configuration, usually in HCL, describing resources and settings.
- Run
terraform initto download providers and reusable modules. - Run
terraform planto compare configuration and state with live infrastructure. - Review proposed additions, updates, and deletions.
- Run
terraform applyto 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.
| Format | Terraform use | Practical note |
|---|---|---|
| HCL | Primary format | Readable and designed for resources, variables, and expressions. |
| JSON | Supported alternative | Useful for generated files, but often harder to edit. |
| YAML | Not native configuration | Common 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.
| Approach | Best for | Main tradeoff |
|---|---|---|
| Terraform | Repeatable environments and reviewed infrastructure changes | Requires configuration and state management. |
| Cloud console | Learning or investigating a service | Manual steps are difficult to reproduce and audit. |
| Imperative scripts | One-time operational tasks | Must 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.
on Emergent today

