github cloudposse/atmos v1.100.0

2 days ago
Improve `terraform` and `helmfile` help. Enable `Go` templating in the `command` field. Clean Terraform workspace before executing `terraform init` @aknysh (#759)

what

  • Improve terraform and helmfile help
  • Enable Go templating in the command field of stack config
  • Clean Terraform workspace before executing terraform init

why

  • Improve the help messages. When a user executes atmos terraform --help or atmos helmfile --help (or help for a subcommand), print a message describing the command and how to execute the terraform and helmfile help command

     atmos terraform --help

image


  • Enable Go templating in the command stack config in addition to the already supported sections.

    You can now use Go templates in the following Atmos sections to refer to values in the same or other sections:

    • vars
    • settings
    • env
    • providers
    • overrides
    • backend
    • backend_type
    • component
    • metadata.component
    • command

    Enabling Go templates in the command section allows specifying different Terraform/OpenTofu/Helmfile versions per component/stack, and get the value from different Atmos sections or from external data sources

  • Clean Terraform workspace before executing terraform init. When using multiple backends for the same component (e.g. separate backends per tenant or account), and if an Atmos command was executed that selected a Terraform workspace, Terraform will prompt the user to select one of the following workspaces:

     1. default
     2. <the previously used workspace>

    The prompt forces the user to always make a selection (which is error-prone), and also makes it complicated when running on CI/CD.

    The PR adds the logic that deletes the .terraform/environment file from the component directory before executing terraform init. The .terraform/environment file contains the name of the currently selected workspace, helping Terraform identify the active workspace context for managing your infrastructure. We delete the file before executing terraform init to prevent the Terraform prompt asking to select the default or the previously used workspace.

Don't miss a new atmos release

NewReleases is sending notifications on new releases.