Apply & inspect state
Learn
What state actually is
State is a mapping: for every resource in your code (demo_server.web) it
records the real object Terraform created (its id and last-known attributes).
It's Terraform's memory. Three worlds have to agree:
- Code — what you declared (the editor).
- State — what Terraform thinks exists (the State pane).
- Real Infrastructure — what actually exists (the Real Infrastructure pane).
After the apply, state holds each address with its real id, like
demo_server.web → demo_server-ea9af2dc, and the server's network_id is the
network's real id: references are resolved and stored.
plan works by refreshing state from the real world, then diffing that against
your code. Almost every state problem is one of those three worlds disagreeing.
Your task
Run apply to build the stack, then study the State Inspector. Notice that State mirrors Real Infrastructure — each resource address maps to a real id. Then answer the questions below.
Your answers are checked when you run this step.