GuideAdvanced

Terraform And Iac

This guide takes the Andes Cargo stack built by hand, command by command, in the AWS Core Services Guide and teaches you to stop creating infrastructure manually and start declaring it. It covers HCL in depth (`resource`, `data`, `variable`, `output`, `locals`, `module`), the `init`/`plan`/`apply`/`destroy` cycle and the idempotency behind it, and dedicates its heaviest module to Terraform's `state`: what it is, why it's the source of truth, how drift gets detected, how to import infrastructure that already exists (the exact real-world problem Andes Cargo has, since it was created by hand in the previous guide), and why a poorly secured state is one of the least-taught security risks in the discipline. It builds two reusable modules (`s3-bucket`, `iam-role`) and uses them to declare the same four canonical Andes Cargo resources — the bucket, both IAM roles, and the Lambda function with its DynamoDB table — proving that a single `terraform apply` recreates what used to require a manual checklist, and a single `terraform destroy` cleans it all up. The capstone runs the same code with OpenTofu, Terraform's open-source fork, and dedicates a lesson to a real March 2026 incident where an AI agent ran `terraform destroy` against production infrastructure without anyone carefully reviewing the plan — installing the rule that no `apply` or `destroy` ever runs without reading the full plan first. Everything runs $0 against the same LocalStack lab from the previous guide.

64
lessons
8
modules
English · Spanish
available in
Yes
certificate
Free
access
NIEVA

Outcomes

What you'll be able to do

  • Explain why declarative infrastructure beats a sequence of imperative commands (reproducibility, Git history, PR review, a `destroy` that actually cleans everything up)
  • Write HCL with judgment: the anatomy of `resource`/`data`/`provider` blocks, the implicit and explicit dependency graph, `fmt` and `validate`
  • Run the `init`/`plan`/`apply`/`destroy` cycle and demonstrate Terraform's idempotency (a second `apply` with no changes does nothing)
  • Parameterize a configuration with `variable`, `.tfvars` files, `locals`, and `output`, respecting the real precedence order
  • Explain what `terraform.tfstate` is, why it's the source of truth, and detect drift by comparing state against reality
  • Import pre-existing infrastructure with `terraform import` and write the HCL that matches what was imported
  • Identify the security risk of a poorly secured state (secrets and ARNs in plain text) and apply the basic mitigations
  • Build reusable Terraform modules (`source`, inputs/outputs) to avoid repeating the same bucket or role definition
  • Declare with Terraform the same services already known (S3, IAM, Lambda, DynamoDB) that were created by hand with the AWS CLI in the previous guide
  • Read a `terraform plan` as the artifact to review before applying, and recognize the blast radius of a poorly reviewed `apply`/`destroy`
  • Run the same HCL code with OpenTofu and explain why the fork exists

Before you start

What you need to bring

It's for you if...

  • Devs who already completed the AWS Core Services Guide and want to stop creating infrastructure by hand with the CLI
  • Teams managing infrastructure through loose commands who need reproducibility, PR review, and Git history
  • Data Engineering devs who need the Terraform piece to complete their software engineering stack (alongside git, tests, and CI/CD, covered in other guides)
  • Anyone who wants to deeply understand Terraform's `state` before touching it in a real production environment

Requirements and materials

  • AWS Core Services Guide completed (IAM, S3, Lambda with an S3 trigger, DynamoDB) with the LocalStack lab already running
  • Basic terminal and shell skills (environment variables, redirection, reading JSON in the terminal)
  • Free LocalStack account with an auth token, no credit card needed
  • Docker installed and running locally

Content

The syllabus, module by module

Open any of them to see its lessons.

Common questions

What people usually ask

Start whenever you like

Reviews

What students say

These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.

No approved reviews yet.

Be the first to share your experience!