terraform-provider-shell
terraform-provider-shell copied to clipboard
Support list/map type for environment argument
There is a case we need a list of value as environment variable and pass in the script to do the loop. It would be great if the environment argument support more than just string.
For example
data "shell_script" "example" {
lifecycle_commands {
read = <<-EOF
bash main.sh
EOF
}
environment = {
TF_SUPPORTED_VERSION = ["1.0", "1.1", "1.2"]
}
working_directory = "./sources"
}
Environments variables are strings.
It's relatively straightforward to do this currently. I either use jsonencode(local.list) if the value is complex or want to process it with jq or for a simple structure like a list of strings I use join(" ", local.list).