← Your First Resource
Plan before you apply
Learn
The anatomy of a resource
resource "demo_server" "web" {
name = "web"
}
resource— the block type."demo_server"— the resource type (what to create)."web"— the local name you reference it by (demo_server.web).- inside the braces — the arguments.
demo_serverrequires aname.
Reading the plan
plan compares your configuration with what Terraform already manages (nothing yet)
and prints what it would do, without changing anything:
# demo_server.web will be created
+ resource "demo_server" "web" {
+ name = "web"
+ image = "base"
+ cpu = 1
+ id = (known after apply)
+ private_ip = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
+ means create. image and cpu are defaults the provider fills in for arguments
you left out. id and private_ip are computed: only the provider knows them, once
the resource really exists, so the plan shows (known after apply).
Reading the plan before applying is the habit that keeps you out of trouble.
Your task
Declare a demo_server named web, then run plan. You should see exactly one resource to add.