liveBook · Manning

Terraform

As explained in Grokking Software Architecture

Terraform is an infrastructure-as-code tool that declaratively provisions and manages resources across multiple cloud and infrastructure providers.

Manually clicking through a cloud portal can leave behind fragile, hard-to-reproduce infrastructure. Terraform replaces those clicks with a declarative blueprint: you describe what you want, and the tool determines the steps and calls the cloud provider’s API. section 9.6.2 section 9.7

Terraform is the engine; HashiCorp Configuration Language (HCL) is the syntax used to write its configuration. Keep the blueprint in version control so changes have a history and environments are easier to recover. section 9.6.2 section 9.12

A database with a memory

Suppose your configuration asks for one PostgreSQL database. Terraform records what it built in a state file. On a later run, it compares the configuration, state, and real cloud resources; if nothing has changed, there is nothing to do. If the configuration changes the allocated storage from 50 to 100, Terraform calculates the required change. section 9.7.2

Figure 9.5 Terraform doesn't just "run scripts"; it reconciles reality with your text files!

See how Terraform reconciles configuration, state, and real infrastructure. section 9.7.2

The state file is important: losing it can leave existing resources unmanaged. For teams, durable remote state and state locking help prevent both loss and conflicting deployments. Modules can also split a large blueprint into smaller pieces, such as networking, databases, and serverless functions. section 9.7.3

To try Terraform without turning practice into a surprise bill:

  • Install the Terraform CLI, choose a provider, and start with a small resource such as a storage bucket in main.tf. section 9.1.4
  • Use a provider’s free tier or LocalStack for practice, and set a billing alarm. section 9.1.4
  • Destroy practice resources when finished with terraform destroy. section 9.1.4

How Grokking Software Architecture covers it

How deep it goes
Explains blueprints, state reconciliation, remote state, locking, and modules without requiring memorization of provider syntax.
Examples
Illustrates reconciliation with a PostgreSQL database and suggests creating a storage bucket as a first exercise.
What you can do after
Apply it via the Terraform CLI to practice declaring a small cloud resource and cleaning it up afterward.
How it connects
Connects Terraform to Infrastructure as Code, declarative configuration, state management, version control, and cloud APIs.

Also explained in

Compare how 6 books explain Terraform →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.