Read a change (~)
Learn
Reading an update
Edit one argument of a resource that already exists, and the plan shows only what changes:
# demo_server.web will be updated in-place
~ resource "demo_server" "web" {
~ cpu = 1 -> 2
}
Plan: 0 to add, 1 to change, 0 to destroy.
~ means update in place: the same server keeps running, with its id and IP,
and one attribute changes. The line reads old value -> new value, and the
attributes that don't change aren't listed at all.
There's a fourth symbol you'll meet later: -/+, replace. Some attributes can't
be changed on a live resource (think of a disk's type, or a server's availability
zone), so Terraform must destroy the resource and create a new one. The plan marks it
must be replaced and counts it as both an add and a destroy. That's the one to look
twice at: a new resource means a new id, and whatever was stored on the old one is
gone.
Your task
Change the server's cpu from 1 to 2, then run plan (don't apply). Now demo_server.web is prefixed with ~ — an in-place update — the changed line reads ~ cpu = 1 -> 2, and the summary is Plan: 0 to add, 1 to change, 0 to destroy.