plumber-cd / terraform-backend-git

Terraform HTTP Backend implementation that uses Git repository as storage
Apache License 2.0
198 stars 19 forks source link

terraform force-unlock doesn't work #45

Open andrey-parkhomets opened 3 months ago

andrey-parkhomets commented 3 months ago

Looks like unlock doesn't work,

to reproduce run and interrupt with ctlr+c until lock released

terraform-backend-git --access-logs git terraform apply

repeat step and get message about existing lock

and finally try to unlock:

➜  tf ~/bin/terraform-backend-git --access-logs git  terraform force-unlock -force f835bc81-3964-1391-81a9-e6b5f098bc52
[terraform-backend-git]: Using config file: /Users/someuser/git/myfolder/tf/terraform-backend-git.hcl
[terraform-backend-git]: WARNING: HTTP basic auth is disabled, please specify TF_BACKEND_GIT_HTTP_USERNAME and TF_BACKEND_GIT_HTTP_PASSWORD
[terraform-backend-git]: WARNING: Access Logs enabled
[terraform-backend-git]: listen on 127.0.0.1:6061
[terraform-backend-git]: Unlocking state in https://github.com/my-org/tf-state?ref=main//my/state.json
[terraform-backend-git]: unexpected end of JSON input
127.0.0.1 - - [23/Jun/2024:17:37:18 +0200] "UNLOCK /?type=git&repository=https://github.com/my-org/tf-state&ref=main&state=my/state.json HTTP/1.1" 500 27
[terraform-backend-git]: Unlocking state in https://github.com/my-org/tf-state?ref=main//my/state.json
[terraform-backend-git]: unexpected end of JSON input
127.0.0.1 - - [23/Jun/2024:17:37:19 +0200] "UNLOCK /?type=git&repository=https://github.com/my-org/tf-state&ref=main&state=my/state.json HTTP/1.1" 500 27
[terraform-backend-git]: Unlocking state in https://github.com/my-org/tf-state?ref=main//my/state.json
[terraform-backend-git]: unexpected end of JSON input
127.0.0.1 - - [23/Jun/2024:17:37:21 +0200] "UNLOCK /?type=git&repository=https://github.com/my-org/tf-state&ref=main&state=my/state.json HTTP/1.1" 500 27
Failed to unlock state: Failed to unlock: UNLOCK http://localhost:6061/?type=git&repository=https://github.com/my-org/tf-state&ref=main&state=my/state.json giving up after 3 attempt(s)
Error: exit status 1

Workaround: delete appropriate branch