Disabling TF workspaces when using HTTP backend seems to be broken
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 134
Description
### Describe the Bug
I tried running Atmos against HTTP backend(Gitlab).
When using terraform commands like plan or apply, atmos fails with the error:
```shell
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.
```yaml
components:
terraform:
workspaces_enabled: false
```
Configuration seems to used:
```shell
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).
```shell
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_
Contributor guide
Research direction
Reproduce `atmos terraform plan router -s dev` with `workspaces_enabled: false` in `atmos.yaml`, then compare it with the direct `tofu apply` from `components/terraform/router`. Trace the `atmos terraform` execution path and how the generated `backend.tf.json` settings are passed to Terraform/OpenTofu. Done means the HTTP backend runs without workspace operations when workspaces are disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gitlab, go, terraform
- Domain
- cli, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100