Skip to content
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

Support an updated template_file until string templates are in terraform core #47

Open
nitrocode opened this issue Jun 30, 2021 · 0 comments

Comments

@nitrocode
Copy link
Member

nitrocode commented Jun 30, 2021

Have a question? Please checkout our Slack Community or visit our Slack Archive.

Slack Community

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)

Additional Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant