matti / terraform-shell-resource

Run (exec) a command in shell and capture the output (stdout, stderr) and status code (exit status)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Environment variables are not supported

nmiodice opened this issue · comments

I'd like to pass TF configuration (tf vars) though to my command (which is a complex script that relies on ENV vars), but am unable to do so because there is no ability to pass environment vars.

can you give me a more concrete example?

I'd like to run something like this:

module "files" {
  source  = "matti/resource/shell"
  command = "echo $FOO"
  environment = {
    FOO       = var.foo
  }
}

Of course, the actual business logic in the script is more complex and relies on a number of environment variables. Passing them in as arguments may be complicated as I'd need to also handle escape characters

environment variables are supported now, see the README