State, stacks & the up/preview loop
How Pulumi tracks reality.
Like every desired-state tool, Pulumi keeps state — a record mapping the resources in your program to the real ones it created, so it can compute the difference on the next run. The loop is preview then up: pulumi preview shows what would change, pulumi up shows it again and (on confirm) makes it real. pulumi destroy tears the stack down. Reading the preview before confirming is the safety habit.
$ pulumi previewType Name Plan~ aws:s3:BucketV2 logs update [diff: ~tags]+- aws:rds:Instance db replace [diff: ~engineVersion]$ pulumi up # shows the same, asks to confirm
State can contain sensitive resource attributes, so it is protected: Pulumi Cloud stores it server-side with access control, and self-managed backends store it in your bucket where you must lock it down. Secrets inside state are encrypted (next lessons), which is a meaningful difference from raw Terraform state where secrets sit in plaintext.