local_file

The resource type from the local provider that creates a file with given content at a given path.

In more detail

It takes filename and content arguments. Changing the content cannot be done in place, so the plan shows a replacement: the file is deleted and written again. As a data source, data.local_file reads an existing file without managing it.

Example

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

Related terms

Taught in

References

Certification courses