Hi,
I'm using get_env() to wrap some environment variables expected by some modules with a different name, as follows :
extra_arguments "env_var_mapping" {
commands = ["${get_terraform_commands_that_need_vars()}"]
arguments = ["-var", "my_var=${get_env("VAR_NAME")}"]
}
I'm willingly using get_env() without the DEFAULT argument as I wan't terraform to warn/abort if the associated variable is not provided.
The thing is that Terragrunt does not currently support thus and complains:
Invalid parameters. Expected syntax of the form '${get_env("VAR_NAME", "default")}', but got '"VAR_NAME"'
Of course I could pass variables prefixed by TF_VAR_ but i'd like to have the freedom not to name env variables following the name of variables expected by terraform modules, hence the use of terragrunt here.
Rationales for env var remapping:
What do you think of allowing the use of get_env() helper without the default argument ?
(or do you have an alternative in mind ?)
A big +1 on this. I've hit the exact same issue with variables such as password that need to be set across different environments. A PR for this would be very welcome.
hey @brikis98 !
Provide me with a starting point and I could handle this i guess, it should not be too difficult.
Here you go: https://github.com/gruntwork-io/terragrunt/blob/master/config/config_helpers.go#L83-L84.
Thanks!
do we have any updates for this?
@ozbillwang we had discussions with @brikis98 on the proper way to do it (see: https://github.com/gruntwork-io/terragrunt/pull/393) but then i got caught by somethingelse, and do not use the get_env() helper in the end.
Feel free to resume the PR
Most helpful comment
A big +1 on this. I've hit the exact same issue with variables such as
passwordthat need to be set across different environments. A PR for this would be very welcome.