2017-03-16 11:51:51 +01:00
|
|
|
---
|
|
|
|
layout: "local"
|
|
|
|
page_title: "Local: local_file"
|
|
|
|
sidebar_current: "docs-local-resource-file"
|
|
|
|
description: |-
|
|
|
|
Generates a local file from content.
|
|
|
|
---
|
|
|
|
|
2017-04-17 19:45:10 +02:00
|
|
|
# local_file
|
2017-03-16 11:51:51 +01:00
|
|
|
|
2017-04-17 19:45:10 +02:00
|
|
|
Generates a local file with the given content.
|
|
|
|
|
|
|
|
~> **Note** When working with local files, Terraform will detect the resource
|
|
|
|
as having been deleted each time a configuration is applied on a new machine
|
|
|
|
where the file is not present and will generate a diff to re-create it. This
|
|
|
|
may cause "noise" in diffs in environments where configurations are routinely
|
|
|
|
applied by many different users or within automation systems.
|
2017-03-16 11:51:51 +01:00
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 19:45:10 +02:00
|
|
|
```hcl
|
|
|
|
resource "local_file" "foo" {
|
2017-03-16 11:51:51 +01:00
|
|
|
content = "foo!"
|
|
|
|
filename = "${path.module}/foo.bar"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
2017-04-17 19:45:10 +02:00
|
|
|
* `content` - (Required) The content of file to create.
|
2017-03-16 11:51:51 +01:00
|
|
|
|
2017-04-17 19:45:10 +02:00
|
|
|
* `filename` - (Required) The path of the file to create.
|
2017-03-16 11:51:51 +01:00
|
|
|
|
2017-04-17 19:45:10 +02:00
|
|
|
Any required parent directories will be created automatically, and any existing
|
|
|
|
file with the given name will be overwritten.
|