github cloudposse/atmos v1.120.0

latest releases: v1.130.0, v1, v1.129.0...
13 days ago
Export configuration information in shell launched by Atmos @Nuru (#827)

what

  • Export Atmos Terraform configuration information in shell launched by Atmos

why

  • When Atmos launches a shell, it configures the shell for Terraform to reference a certain component and stack. The configuration is such that Terraform commands will work with a specific component and stack when run from a specific directory, and that informations is output to the user, but it has not been available in the environment for scripts or other automation to reference. By exposing that information in the environment, tools (e.g. the command prompt) can notify the user of the invisible state information and also warn the user if they are executing commands from the wrong directory and help them get back to the right one, among other possibilities.

  • Some commands, like atmos terraform shell, spawn an interactive shell with certain environment variables set, in order to enable the user to use other tools (in the case of atmos terraform shell, the Terraform or Tofu CLI) natively, while still being configured for a specific component and stack. To accomplish this, and to provide visibility and context to the user regarding the configuration, Atmos sets the following environment variables in the spawned shell

Variable Description
ATMOS_COMPONENT The name of the active component
ATMOS_SHELL_WORKING_DIR The directory from which native commands should be run
ATMOS_SHLVL The depth of Atmos shell nesting. When present, it indicates that the shell has been spawned by Atmos.
ATMOS_STACK The name of the active stack
ATMOS_TERRAFORM_WORKSPACE The name of the Terraform workspace in which Terraform comamnds should be run
PS1 When a custom shell prompt has been configured in Atmos, the prompt will be set via PS1
TF_CLI_ARGS_* Terraform CLI arguments to be passed to Terraform commands

Don't miss a new atmos release

NewReleases is sending notifications on new releases.