Skip to content

v1.105.0

Compare
Choose a tag to compare
@cloudposse-releaser cloudposse-releaser released this 12 Nov 13:46
· 76 commits to refs/heads/main since this release
74516e6
Clean Terraform workspace before executing `terraform init` in the `atmos.Component` template function @aknysh (#775)

what

  • Clean Terraform workspace before executing terraform init in the atmos.Component template function

why

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.

This PR adds the logic that deletes the .terraform/environment file from the component directory before executing terraform init when executing the atmos.Component template function. It allows executing the atmos.Component function for a component in different Terraform workspaces without Terraform asking to select a workspace. The .terraform/environment file contains the name of the currently selected workspace, helping Terraform identify the active workspace context for managing your infrastructure.