Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atmos terraform workspace does not set workspace #574

Closed
Nuru opened this issue Apr 5, 2024 · 0 comments · Fixed by #580
Closed

atmos terraform workspace does not set workspace #574

Nuru opened this issue Apr 5, 2024 · 0 comments · Fixed by #580
Labels
bug 🐛 An issue with the system

Comments

@Nuru
Copy link
Contributor

Nuru commented Apr 5, 2024

Describe the Bug

Prior to Atmos v1.55.0 and #515, atmos terraform init and atmos terraform workspace would select the correct Terraform workspace for the component and stack, allowing further terraform commands to work correctly without needing atmos to wrap them.

Now, atmos terraform init leaves the selected workspace as-is and atmos terraform workspace does nothing. This has lead me to come close to applying changes to the wrong environment and I fear that soon I will not catch onto the situation and make the bad changes by mistake.

Expected Behavior

atmos terraform workspace by definition should select the Terraform workspace using terraform workspace select, leaving the workspace selected for future terraform commands (without Atmos).

I would also like atmos terraform init to resume its previous behavior of selected the workspace, so that I do not have to explicitly run atmos terraform workspace to select the workspace, as was the case before v1.55.

Steps to Reproduce

  • terraform workspace select default
  • atmos terraform workspace <component> -s <stack>
  • terraform workspace list

Output will show that the default workspace is still selected.

Screenshots

No response

Environment

No response

Additional Context

The justification for the change in #515 was that it was more efficient than running 2 commands, one to switch to the workspace and another to create it if it did not exist. Since Terraform 1.4, terraform workspace select has an -or-create option allowing you to restore the old behavior with a single command:

terraform workspace select -or-create <workspace>

However, if you want to continue to support older versions of Terraform, you can simply revert the change in #515. IMHO, the lack of persistence of workspace selection is not worth the minimal (if any) efficiency improvement. The create command is only run rarely, and under the hood Terraform must be running the same logic anyway.

@Nuru Nuru added the bug 🐛 An issue with the system label Apr 5, 2024
@Nuru Nuru closed this as completed in #580 Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant