"${path.module}/init.tpl"` similar to the example in
https://www.terraform.io/docs/providers/template/r/file.html, (though in my case I am using https://www.terraform.io/docs/provisioners/file.html), but you are doing this in a module, and you want that path to be a variable. You cannot use ${path.module} in a variable definition, you'll get something like: * Variable 'post_init_script_path': cannot contain interpolations
How should this be done? I'd like the module to default to a script that is included in the module, but I want the user/caller of the module to have the option to provide a path to their own script.
Let's say you are using `"${path.module}/init.tpl"` similar to the example in
https://www.terraform.io/docs/providers/template/r/file.html, (though in my case I am using https://www.terraform.io/docs/provisioners/file.html), but you are doing this in a module, and you want that path to be a variable. You cannot use${path.module} in a variable definition, you'll get something like: * Variable 'post_init_script_path': cannot contain interpolations
How should this be done? I'd like the module to default to a script that is included in the module, but I want the user/caller of the module to have the option to provide a path to their own script.
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/a307c667-7428-4daf-b640-cca1c8cc3354%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
This is a good case for `coalesce()`. I believe this pattern will do what you're looking for: