Creating a well-structured cloud network by hand can take hours. Terraform lets you describe the infrastructure once, deploy it, and reuse the configuration for another environment. It is an infrastructure-as-code tool: developers define the desired system in the Terraform language, and Terraform works out the changes needed to reach it. section 1.0 section 1.3
A configuration is built largely from blocks. A resource block represents infrastructure Terraform should manage; its type maps through a provider to a vendor-specific component, such as a cloud instance or DNS record. Data sources look up existing information, while modules package resources and data sources for reuse. Terraform core runs in the command-line interface (CLI); providers handle communication with the underlying systems. section 2.10 section 2.5 section 1.2
A typical change follows three CLI-driven stages:
- Run `terraform init` to obtain needed providers or modules. section 1.7
- Run `terraform plan` and review the proposed changes before deployment. section 1.4 section 1.7
- Run `terraform apply` to carry out the plan. A saved plan file can be passed to the command; without one, Terraform creates a plan as apply begins. section 1.4.4
Launching a cloud instance
Add a resource representing an AWS EC2 instance, review its plan, then run `terraform apply tfplan` with the saved plan. Terraform reports creation progress, the instance ID, and a final count of resources added, changed, or destroyed. A small change may add one instance; other changes may update or replace existing resources. section 1.4.1 section 1.4.4
References between resources also express dependencies. If an application uses a value supplied by its database, Terraform can infer that the database must come first. It turns these relationships into an ordered plan and can run independent operations concurrently. Circular dependencies are a limitation: resources that all wait on one another need a workaround rather than an ordinary apply. section 1.3.2 section 1.3.3 section 1.4.4
Terraform tracks managed resources in state. A backend specifies where that state is stored, and workspaces distinguish deployments within a backend. Keep that deployment context in mind when reviewing a plan: the same reusable module can help teams create separate environments, but each deployment has its own state. section 1.2 section 1.1.2
OpenTofu is an open-source fork created after Terraform's license change. Its CLI generally uses the same commands and has remained compatible with Terraform code, but features added to either project may not be available immediately in the other. section 1.6 section 1.6.5 section 1.6.6




