TerraformAdvanced~5h

Terraform

The plan, before the tool runs it

Terraform is not hard because of its syntax. It is hard because a plan is a diff between three things — your configuration, a state file that claims what exists, and a world that may have moved since. Learn to read all three and you can say what apply will do before you type it.

Modules
5
Drills
10
Build steps
4
Time
~5h

Walk out able to

Look at a configuration, a state and a reality and name the proposed action for every resource — and refactor a repository without destroying anything.

What you learn to read

01

Declarations and addresses

What a block asserts, and what names one instance.

02

State, and what it claims

The mapping, and what each operation moves.

03

Configuration, state, world

The five actions, and the summary line at the bottom.

04

Modules, and drift

Refactor without casualties; decide when the world wins.

The pitch

What you practise, and what you leave with

A root module with a child called twice, a keyed collection and a moved block — plus your written prediction of its plan at four points in its life.

You will practise

  • Name the action plan proposes
  • Total a summary, replacements included
  • Write any instance address
  • Decide what to do about drift

Afterwards you can

  • Predict a plan before you run it
  • Refactor into a module, destroy nothing
  • Say what state rm really did
  • Choose between reverting drift and keeping it

Modules

5 modules, 32 items

Lessons explain one idea. Drills repeat it until it sticks. Build steps make something that exists afterwards.

  1. 1

    Declare it, name who runs it

    ~1h

    Say what a resource block asserts, and write the address of any instance in it.

    • LessonWhy describe it instead of doing it4 min
    • LessonWhat a resource block asserts6 min
    • LessonThe two words are an address6 min
    • LessonWhat init downloads, and what pins it6 min
    • DrillPick the version init installs9 min
    • DrillWrite any instance address9 min
    • DrillType the word the block is missing12 min
    • Build stepBuild a root module that writes files10 min
  2. 2

    State: a claim about the world

    ~45 min

    Predict what each state operation does to the binding, and what it does to the object.

    • LessonWhat state actually holds8 min
    • LessonThe four jobs state does6 min
    • LessonYour secrets are in the state file6 min
    • LessonWhere the state file should live6 min
    • DrillSay what the operation moved10 min
    • Build stepBreak a binding and watch it survive9 min
  3. 3

    Plan is a three-way diff

    ~1h

    Name the action plan proposes for any resource, and total the summary line.

    • LessonConfiguration, state, reality9 min
    • LessonThe five things plan can propose8 min
    • LessonWhy some values are not numbers yet6 min
    • DrillName what plan proposes12 min
    • DrillTotal a plan summary12 min
    • DrillSay what a lifecycle rule does10 min
    • Build stepPredict the plan before you run it12 min
  4. 4

    One shape, many times

    ~56 min

    Route values through a module, and refactor into one without destroying anything.

    • LessonWhat crosses a module boundary8 min
    • LessonWhat a call does to every address6 min
    • LessonWhy a refactor destroys things7 min
    • DrillGet a value through a module10 min
    • DrillRemove one element from a collection12 min
    • Build stepExtract a module, destroy nothing13 min
  5. 5

    When the claim is wrong

    ~49 min

    Recognise drift, choose between reverting it and keeping it, and build the whole thing.

    • LessonDrift, and the fix that is not one7 min
    • LessonTwo honest answers, and you pick one6 min
    • LessonWhen neither answer is right7 min
    • DrillDecide what to do about drift11 min
    • LessonBuild it, and predict every plan18 min

Say what apply will do before you run it.

The first item is free. ~5h of focused work, at your own pace.

Advanced~5h5 modules