Helmsman Academy
Terraform, end to end

Terraform in teams: modules, refactoring, secrets and HCP Terraform

6 lessons · about 105 minutes of reading · Helmsman Pro

This page is the public course outline. Lessons, labs, tools and exams open after you sign in to your free account.

Sign in and start

In short

How teams use Terraform safely: modules with clean interfaces, lifecycle guardrails and custom conditions, importing and refactoring existing estates, drift and debugging, secrets without leaks, and HCP Terraform's workflows and governance.

Before you start: Course 47 or equivalent Terraform experience.

What you'll learn

Lessons

1. Writing and using modules

Package infrastructure as modules: structure, inputs and outputs, variable scope, sources (local, registry, Git), versioning, composition and publishing.

Sign in to open the lesson

2. Lifecycle rules, custom conditions and checks

Protect and shape changes with create_before_destroy, prevent_destroy, ignore_changes and replace_triggered_by, and catch bad assumptions with preconditions, postconditions and check blocks.

Sign in to open the lesson

3. Importing, refactoring and querying existing infrastructure

Bring existing resources under Terraform with import blocks and generated configuration, find them in bulk with terraform query, and refactor safely with moved and removed blocks.

Sign in to open the lesson

4. Drift, debugging and recovering from trouble

Detect and fix drift, read refresh-only plans, force replacements, debug with TF_LOG, and recover from locks, failed applies and corrupted state.

Sign in to open the lesson

5. Secrets and sensitive data: ephemeral values, write-only arguments and Vault

Keep secrets out of code, plans and state: workload identity for providers, sensitive and ephemeral values, write-only arguments, Key Vault and HashiCorp Vault.

Sign in to open the lesson

6. HCP Terraform and Terraform Enterprise

What HCP Terraform adds: remote runs and state, workspaces and projects, VCS, CLI and API workflows, variable sets, policies, run tasks, private registry, agents and Stacks.

Sign in to open the lesson

Common questions

How does a parent read a child's values?

Through the child's outputs: module.<name>.<output>.

Which lifecycle argument forces replacement when another value changes?

replace_triggered_by.

Which flag drafts configuration for import blocks?

terraform plan -generate-config-out=<file>.

Is terraform refresh still recommended?

No; use terraform plan -refresh-only and apply -refresh-only, which show the change first.

Which Terraform version added ephemeral resources?

1.10.

Which block connects a configuration to HCP Terraform?

The cloud block inside terraform {}.