terraform-provider-shell icon indicating copy to clipboard operation
terraform-provider-shell copied to clipboard

Support list/map type for environment argument

Open dung-leviethoang-mox opened this issue 3 years ago • 2 comments

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"
}

dung-leviethoang-mox avatar Jun 03 '22 17:06 dung-leviethoang-mox

Environments variables are strings.

pauldraper avatar Apr 09 '23 14:04 pauldraper

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).

stevehipwell avatar Oct 25 '23 09:10 stevehipwell