Imagine rebuilding a server by retracing a maze of portal clicks. Miss one checkbox and the replacement may behave differently. Infrastructure as Code (IaC) replaces that guessing game with version-controlled text files that define and automate computing resources. section 9.1.2 section 9.6.1
A declarative blueprint describes what should exist, rather than spelling out every step to create it. An IaC engine works out the necessary changes and communicates with the cloud provider. The blueprint also records infrastructure decisions alongside application code. section 9.6.2 section 9.1.3
From a click to a blueprint
Instead of clicking through a portal to create storage, start with one resource block in a Terraform file named main.tf. Terraform is the engine; HashiCorp Configuration Language (HCL) is the syntax used to write its blueprints. Terraform translates the desired configuration into provider API calls. section 9.1.4 section 9.6.2 section 9.7
Terraform keeps a state file as a memory of what it has built. It compares the desired configuration, its recorded state, and the real cloud to work out what needs changing. If a database is already present and unchanged, there is nothing to do; changing its declared storage can lead to an update instead of a second database. section 9.7.2
Figure 9.5 Terraform doesn't just "run scripts"; it reconciles reality with your text files!

See how Terraform reconciles the blueprint, state file, and cloud resources. section 9.7.2
Treat infrastructure changes like software changes:
- Commit the blueprint to version control and use a pull request so another developer can review changes before they reach the cloud. section 9.6.3
- Use the blueprint to create a staging environment or rebuild infrastructure after a failure, rather than reconstructing it from remembered clicks. section 9.6.3
- For team workflows, use secure remote state and state locking to avoid relying on one local file or colliding changes. section 9.12
- Review the plan for destructive changes. A useful checkpoint is: “Does this plan delete any data?” section 9.9
Automation does not make cloud resources free. For a first experiment, consider a local AWS simulation with LocalStack or a provider’s free tier, set a billing alarm, and destroy practice resources when finished. section 9.1.4
















