v1.100.0
Improve `terraform` and `helmfile` help. Enable `Go` templating in the `command` field. Clean Terraform workspace before executing `terraform init` @aknysh (#759)
what
- Improve
terraform
andhelmfile
help - Enable
Go
templating in thecommand
field of stack config - Clean Terraform workspace before executing
terraform init
why
-
Improve the help messages. When a user executes
atmos terraform --help
oratmos helmfile --help
(or help for a subcommand), print a message describing the command and how to execute theterraform
andhelmfile
help commandatmos terraform --help
-
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 thecommand
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 executingterraform 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 executingterraform init
to prevent the Terraform prompt asking to select the default or the previously used workspace.