github cloudposse/atmos v1.34.0

latest releases: v1.88.1, v1, v1.88.0...
17 months ago

what

  • Update env stack config section
  • Allow using null to unset the ENV var

why

  • If it's set to null, it will not be set as ENV var in the executing process (will be just skipped)
  • Setting it to null will override all other values set in the stack configs for the component
  • This is useful if an ENV var is set globally in top-level stacks for the entire configuration, but needs to be unset for some specific components

test

Set TEST_ENV_VAR4 to some value

components:
  terraform:
    "test/test-component-override-3":
      env:
        TEST_ENV_VAR1: "val1-override-3"
        TEST_ENV_VAR2: "val2-override-3"
        TEST_ENV_VAR3: "val3-override-3"
        TEST_ENV_VAR4: "val4-override-3"
atmos terraform plan test/test-component-override-3 -s tenant1-ue2-dev
Using ENV vars:
TEST_ENV_VAR1=val1-override-3
TEST_ENV_VAR2=val2-override-3
TEST_ENV_VAR3=val3-override-3
TEST_ENV_VAR3=val4-override-3

Set TEST_ENV_VAR4 to null to unset (skip) it

Setting an ENV var to null in stack config has the effect of unsetting it because the exec.Command, which sets these ENV vars in the executing process, is itself executed in a separate process started by the os.StartProcess function.

components:
  terraform:
    "test/test-component-override-3":
      env:
        TEST_ENV_VAR1: "val1-override-3"
        TEST_ENV_VAR2: "val2-override-3"
        TEST_ENV_VAR3: "val3-override-3"
        # Use `null` to unset the ENV var.
        # If it's set to `null`, it will not be set as ENV var in the process (will be just skipped).
        # Setting it to `null` will override all other values set in the stack configs for the component.
        TEST_ENV_VAR4: null
atmos terraform plan test/test-component-override-3 -s tenant1-ue2-dev
Using ENV vars:
TEST_ENV_VAR1=val1-override-3
TEST_ENV_VAR2=val2-override-3
TEST_ENV_VAR3=val3-override-3

Don't miss a new atmos release

NewReleases is sending notifications on new releases.