scottwinkler / terraform-provider-shell

Terraform provider for executing shell commands and saving output to state file
Mozilla Public License 2.0
279 stars 61 forks source link

Override OS environment variables instead of vice versa #19

Closed juergenhoetzel closed 4 years ago

juergenhoetzel commented 4 years ago

When environment variables are also set in the os environment:

juergen@lemmy:~/tmp/terraform-provider-shell/examples → yolo=foo terraform apply
data.shell_script.test: Refreshing state...

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:
...
  # shell_script.test6 will be created
  + resource "shell_script" "test6" {
      + dirty             = false
      + environment       = {
          + "ball" = "room"
          + "yolo" = "yolo"

...

terraform environment config has no effect:

juergen@lemmy:~/tmp/terraform-provider-shell/examples → terraform state show shell_script.test6
# shell_script.test6:
resource "shell_script" "test6" {
    dirty             = false
    environment       = {
        "ball" = "room"
        "yolo" = "yolo"
    }
    id                = "bn4qlgjcobsd8o2f2k4g"
    output            = {
        "commit_id"      = "b8f2b8b"
        "current_date"   = "09/10/2014"
         "environment"    = "foo"
                         ^^^^^^^^^^^^^^^
}