Terraform resource

A resource block, which asks Terraform to create and manage one piece of infrastructure such as a network, file or database.

In more detail

It has two labels: the resource type, which comes from a provider, and a name you choose. Terraform records every resource it creates in state and from then on owns it, so it will update or delete it to match the configuration. To use something you do not own, read it with a data source instead.

Example

resource "local_file" "greeting" {
  filename = "hello.txt"
  content  = "Hello from Terraform\n"
}

Related terms

Taught in

References

Certification courses