teluzia.Cloud Engineer · Day 91
CHAPTER 13 · TERRAFORM FUNDAMENTALS

Week 13 review, recall and recovery

30–90 min including independent practice6 topicsRecall, catch-up, or rest
LET’S MAKE THIS SIMPLE

What you’re learning today

Rebuild a local modular Terraform project from memory. Create root and child naming modules using variables, locals, terraform_data, and outputs; initialize, validate, plan, review, and apply only local built-in resources. Record state addresses, output values, one reviewed plan, and local destroy evidence. Treat the review as a short evidence-based check: use the existing local lab or paper design, record which outcomes you actually reproduced, and repair one named gap before adding more complexity. Do not create extra billable resources just to prove recall.

Think of it this way

A weekly review is a recovery drill: demonstrate the system, inject one controlled mistake, and explain the evidence that proves repair.

TOPIC 01 / 06Step by step

Infrastructure as code

IaC represents infrastructure intent in reviewable files. Version control records changes and supports collaboration, but files still require safe execution and operational ownership. Declarative configuration describes desired objects rather than a fixed sequence of shell actions. For example, a resource block describes one object; the provider performs API calls to converge it.

WORKED EXAMPLE
A resource block describes one object; the provider performs API calls to converge it.
Why this matters

A resource block describes one object; the provider performs API calls to converge it.

A common trap

Do not overlook this operational distinction: Declarative configuration describes desired objects rather than a fixed sequence of shell actions.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Infrastructure as code

IaC represents infrastructure intent in reviewable files. Version control records changes and supports collaboration, but files still require safe execution and operational ownership. Declarative configuration describes desired objects rather than a fixed sequence of shell actions. For example, a resource block describes one object; the provider performs API calls to converge it.

WORKED EXAMPLE
A resource block describes one object; the provider performs API calls to converge it.

Why this matters

A resource block describes one object; the provider performs API calls to converge it.

A common trap

Do not overlook this operational distinction: Declarative configuration describes desired objects rather than a fixed sequence of shell actions.

HCL blocks and expressions

HCL uses blocks, arguments, and expressions. Block labels distinguish object type and name, while expressions reference values. Formatting improves readability but does not establish correctness. Learn braces, quoted strings, and references before combining complex collections or dynamic blocks. For example, resource "terraform_data" "demo" { input = "hello" } has type terraform_data and local name demo.

WORKED EXAMPLE
resource "terraform_data" "demo" { input = "hello" } has type terraform_data and local name demo.

Why this matters

resource "terraform_data" "demo" { input = "hello" } has type terraform_data and local name demo.

A common trap

Do not overlook this operational distinction: Learn braces, quoted strings, and references before combining complex collections or dynamic blocks.

Input variables and validation

Variables make configuration adjustable with explicit types, defaults, descriptions, and optional validation. Sensitive marking affects display but is not encryption. Values supplied by variable files or environment need deliberate precedence and protection, especially when automation selects an environment. For example, a region variable has type string; a replicas variable has a validation requiring a positive integer.

WORKED EXAMPLE
A region variable has type string; a replicas variable has a validation requiring a positive integer.

Why this matters

A region variable has type string; a replicas variable has a validation requiring a positive integer.

A common trap

Do not overlook this operational distinction: Values supplied by variable files or environment need deliberate precedence and protection, especially when automation selects an environment.

Output values and interfaces

Outputs expose expressions from a root module or child module. They can communicate IDs, URLs, or other useful results. Sensitive outputs suppress ordinary display but remain in state, and commands or downstream consumers may reveal values. Treat output design as an interface with controlled exposure. For example, a network module exposes vpc_id, letting callers reference the ID without reaching into internal resource addresses.

WORKED EXAMPLE
A network module exposes vpc_id, letting callers reference the ID without reaching into internal resource addresses.

Why this matters

A network module exposes vpc_id, letting callers reference the ID without reaching into internal resource addresses.

A common trap

Do not overlook this operational distinction: Treat output design as an interface with controlled exposure.

Plan actions and replacements

Read each addition, update, replacement, and deletion in the plan. Some attribute changes require replacement, which can affect identities and data. A saved plan records a particular proposal and may contain sensitive values; protect it and re-plan when relevant inputs or environment conditions change. For example, a resource marked -/+ is being replaced rather than updated in place, which deserves careful dependency and downtime review.

WORKED EXAMPLE
A resource marked -/+ is being replaced rather than updated in place, which deserves careful dependency and downtime review.

Why this matters

A resource marked -/+ is being replaced rather than updated in place, which deserves careful dependency and downtime review.

A common trap

Do not overlook this operational distinction: A saved plan records a particular proposal and may contain sensitive values; protect it and re-plan when relevant inputs or environment conditions change.

Module structure and interfaces

A module groups configuration under a directory and presents inputs and outputs. The root module calls child modules. Avoid hiding all configuration behind many trivial modules; boundaries should reflect reusable responsibility with clear validation, versioning, and documentation. For example, modules/network accepts a CIDR and returns vpc_id and subnet IDs for callers.

WORKED EXAMPLE
modules/network accepts a CIDR and returns vpc_id and subnet IDs for callers.

Why this matters

modules/network accepts a CIDR and returns vpc_id and subnet IDs for callers.

A common trap

Do not overlook this operational distinction: Avoid hiding all configuration behind many trivial modules; boundaries should reflect reusable responsibility with clear validation, versioning, and documentation.

KEEP THESE WITH YOU

Today’s takeaways

Infrastructure as code: IaC represents infrastructure intent in reviewable files. Version control records changes and supports collaboration, but files still require safe execution and operational ownership. Declarative configuration describes desired objects rather than a fixed sequence of shell actions.

HCL blocks and expressions: HCL uses blocks, arguments, and expressions. Block labels distinguish object type and name, while expressions reference values. Formatting improves readability but does not establish correctness. Learn braces, quoted strings, and references before combining complex collections or dynamic blocks.

Input variables and validation: Variables make configuration adjustable with explicit types, defaults, descriptions, and optional validation. Sensitive marking affects display but is not encryption. Values supplied by variable files or environment need deliberate precedence and protection, especially when automation selects an environment.

Output values and interfaces: Outputs expose expressions from a root module or child module. They can communicate IDs, URLs, or other useful results. Sensitive outputs suppress ordinary display but remain in state, and commands or downstream consumers may reveal values. Treat output design as an interface with controlled exposure.

Plan actions and replacements: Read each addition, update, replacement, and deletion in the plan. Some attribute changes require replacement, which can affect identities and data. A saved plan records a particular proposal and may contain sensitive values; protect it and re-plan when relevant inputs or environment conditions change.

Module structure and interfaces: A module groups configuration under a directory and presents inputs and outputs. The root module calls child modules. Avoid hiding all configuration behind many trivial modules; boundaries should reflect reusable responsibility with clear validation, versioning, and documentation.

CLOSE THE LOOP

Ready to complete this day?

Verify your recall or recovery steps, then finish this review day.

Lab steps verifiedReview day: quiz optional