Resources

View saved

Resource blocks

Syntax: resource "TYPE" "NAME" { ... }. The name is Terraform's local address, not always the cloud name.

resource "local_file" "hello" {
  filename = "${path.module}/hello.txt"
  content  = "Hello from Terraform\n"
}

Apply to create

After init, plan then apply.

terraform plan
terraform apply

Inspect state

Terraform records what it created.

terraform state list
terraform state show local_file.hello

Change and re-apply

Edit content, run plan/apply again. Terraform updates the file in place when possible.

Comments

One comment per signed-in account. Comments are saved with this page’s URL.