Terraform is an open-source infrastructure-as-code tool developed by HashiCorp. It primarily provisions new infrastructure—such as servers, databases, networks, and cloud resources—rather than managing configurations on existing devices. section 25.2.2 section 25.0
Terraform uses a declarative model: configuration files describe the desired end state instead of prescribing step-by-step procedures. Terraform Core compares that desired state with the Terraform state file, then works through providers to reconcile infrastructure. section 25.2.2 section 25.3
Use the basic Terraform workflow in three stages:
- Write: define desired infrastructure resources in HCL configuration files. section 25.2.2
- Plan: inspect and verify the changes Terraform intends to execute. section 25.2.2
- Apply: execute the plan to provision and manage resources according to the configuration. section 25.2.2
- Classify Terraform as declarative, agentless, and push-based; its configuration language is HCL and its implementation language is Go. section 25.2 section 25.3
Terraform and Ansible can complement each other: Terraform provisions infrastructure, while Ansible primarily manages the configuration of infrastructure that already exists. Both tools can perform both roles, but their typical strengths differ. section 25.2.2
Figure 25.6 Provisioning resources with Terraform. Configuration files are processed byTerraform Core to interact with various providers (i.e., public cloud providers) and manage infrastructure resources while maintaining state information in the state file.
Trace how HCL configuration reaches providers through Terraform Core while infrastructure state is maintained in the state file. section 25.2.2




