-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template_file: source contents instead of path #3909
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ Renders a template from a file. | |
|
||
``` | ||
resource "template_file" "init" { | ||
filename = "${path.module}/init.tpl" | ||
template = "${file(${path.module}/init.tpl)}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @phinze I was updating our configuration due to this PR and tried to update to the configuration above, but it's not proper syntax. It should be Otherwise, you get There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops - you're totally right. I see you already filed a PR - thank you! |
||
|
||
vars { | ||
consul_address = "${aws_instance.consul.private_ip}" | ||
|
@@ -27,17 +27,24 @@ resource "template_file" "init" { | |
|
||
The following arguments are supported: | ||
|
||
* `filename` - (Required) The filename for the template. Use [path | ||
variables](/docs/configuration/interpolation.html#path-variables) to make | ||
this path relative to different path roots. | ||
* `template` - (Required) The contents of the template. These can be loaded | ||
from a file on disk using the [`file()` interpolation | ||
function](/docs/configuration/interpolation.html#file_path_). | ||
|
||
* `vars` - (Optional) Variables for interpolation within the template. | ||
|
||
The following arguments are maintained for backwards compatibility and may be | ||
removed in a future version: | ||
|
||
* `filename` - __Deprecated, please use `template` instead_. The filename for | ||
the template. Use [path variables](/docs/configuration/interpolation.html#path-variables) to make | ||
this path relative to different path roots. | ||
|
||
## Attributes Reference | ||
|
||
The following attributes are exported: | ||
|
||
* `filename` - See Argument Reference above. | ||
* `template` - See Argument Reference above. | ||
* `vars` - See Argument Reference above. | ||
* `rendered` - The final rendered template. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth adding
ConflictsWith
as well? Or warn thatfilename
is ignored iftemplate
is provided? Minor thoughtThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, this is a perfect use case for
ConflictsWith
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.