Disabling TF workspaces when using HTTP backend seems to be broken
Describe the Bug
I tried running Atmos against HTTP backend(Gitlab).
When using terraform commands like plan or apply, atmos fails with the error:
atmos terraform plan router -s dev
...
OpenTofu has been successfully initialized!
workspaces not supported
Failed to get configured named states: workspaces not supported
Error
exit status 1
Even disabling workspaces explicitly via atmos.yaml file does not work.
components:
terraform:
workspaces_enabled: false
Configuration seems to used:
atmos describe component router -s dev|grep workspace
...
workspaces_enabled: false
workspace: default
The generation of the backend file within the component is correct. This can be tested with running terraform on the component (http backend with default workspace is used).
cd components/terraform/router
## Backend has been generated by atmos as defined in _defaults.yaml
grep http backend.tf.json
"http": {
...
tofu apply -auto-approve
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
## Deployment without Atmos uses HTTP backend without having issues
cat .terraform/terraform.tfstate
...
"backend": {
"type": "http",
...
Atoms is generating the TF code correct but during execution it fails.
### Expected Behavior
Workspaces should be disabled when using HTTP backend.
### Steps to Reproduce
Using a simple Atmos stack using HTTP backend (for example using Gitlab or Gitlab.com).
### Screenshots
_No response_
### Environment
- OS: MacOS 15.3.2 (24D81) Apple M2
- Atmos `1.168.0`
- OpenTofu `v1.9.0`
- Terraform `1.11.3`
- Gitlab `17.10.1-ee`
### Additional Context
_No response_
Hi
i was able to workaround that by setting the terraform workspace
for reference: https://github.com/cloudposse/atmos/pull/654
so this works for me:
env TF_WORKSPACE=default atmos terraform plan
To me it looks like this was fixed in the meantime (probably in v178.0 or v182.0), at least here it works in combination with Terraform v1.10.5 and these settings:
components:
terraform:
base_path: 'components/terraform'
deploy_run_init: true
init_run_reconfigure: true
auto_generate_backend_file: true
workspaces_enabled: false