-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Have a question? Please checkout our Slack Community or visit our Slack Archive.
Describe the Feature
The templatefile
function cannot use a string. It has to use a file that has been created prior to the terraform
commands.
Feature would be similar to the archived template_file
data source
Unfortunately hashicorp/terraform-provider-template has been archived before darwin osx supported binary was released.
This maybe... would be a stop gap solution until PR hashicorp/terraform#28700 is implemented.
Expected Behavior
Allow creating template strings without having to create the file
Use Case
For example, if you use a data source with templated variables like the data source aws_iam_policy_document
, you could previously feed in its json text into the template_file
data source and allow replacements. With templatefile
, you can no longer do this easily.
Describe Ideal Solution
Ideal solution would be to implement a templatestring()
but custom providers cannot add new functions.
So the ideal solution would be to recreate the original data source template_file
.
Alternatives Considered
- Manually create a template file containing the iam policy document, add in the appropriate variables, then use
templatefile
to replace them. - Use multiple replace functions which is pretty hacky and could cause issues (example)