`atmos terraform force-unlock` does not work
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 134
Description
### Describe the Bug
`atmos terraform force-unlock` worked before but probably only randomly and doesn't work at all anymore (I guess) since v1.100 which now always cleans the workspace. See below for an example.
I guess the proper solution would be to skip the workspace switch for `force-unlock`.
### Expected Behavior
`atmos terraform force-unlock` should work.
### Steps to Reproduce
1. Configure an S3 backend with a DynamoDB database for locking.
2. Start some `atmos terraform $component --stack $stack apply` but cancel it right in the middle by hitting via Ctrl+C twice.
3. Try `atmos terraform plan $component --stack $stack`
4. Try `atmos terraform force-unlock $component --stack $stack $uuid` where uuid is the value from the previous error.
### Screenshots
```
# atmos terraform force-unlock wms-base --stack wms-xe02-sandbox 8ac7bbfc-c1b4-615d-38d7-f7ba634aa4bb --skip-init
Workspace "wms-xe02-sandbox-wms-base" doesn't exist.
You can create this workspace with the "new" subcommand
or include the "-or-create" flag with the "select" subcommand.
failed to lock s3 state: operation error DynamoDB: PutItem, https response error StatusCode: 400, RequestID: GK00L3DNLAJF2N4KSMUCPHAMA3VV4KQNSO5AEMVJF66Q9ASUAAJG, ConditionalCheckFailedException: The conditional request failed
Lock Info:
ID: 8ac7bbfc-c1b4-615d-38d7-f7ba634aa4bb
Path: sl-atmos-tfstate-123456789012/wms/xe02/sandbox/wms-xe02-sandbox-wms-base/terraform.tfstate
Operation: OperationTypeApply
Who: stretz@slpn-nb-mss
Version: 1.8.5
Created: 2024-11-22 13:59:40.20546289 +0000 UTC
Info:
exit status 1
```
### Environment
- Version 1.105.0
### Additional Context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.