local_file

local_file reads a file from the local filesystem.

Example Usage

data "local_file" "foo" {
    filename = "${path.module}/foo.bar"
}

Argument Reference

The following argument is required:

  • filename - (Required) The path to the file that will be read. The data source will return an error if the file does not exist.

Attributes Exported

The following attribute is exported:

  • content - The raw content of the file that was read.

The content of the file must be valid UTF-8 due to Terraform's assumptions about string encoding. Files that do not contain UTF-8 text will have invalid UTF-8 sequences replaced with the Unicode replacement character.

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/local/d/file.html