Skip to content

Instantly share code, notes, and snippets.

@Scorpil
Created November 5, 2023 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scorpil/283191fbbe03853df4be6d0f531923bf to your computer and use it in GitHub Desktop.
Save Scorpil/283191fbbe03853df4be6d0f531923bf to your computer and use it in GitHub Desktop.
opentofu lock error
$ TF_LOG=trace tofu apply
2023-11-05T13:10:26.037+0100 [INFO]  OpenTofu version: 1.6.0 dev
2023-11-05T13:10:26.038+0100 [DEBUG] using github.com/hashicorp/go-tfe v1.32.1
2023-11-05T13:10:26.038+0100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.18.1
2023-11-05T13:10:26.038+0100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2023-11-05T13:10:26.038+0100 [DEBUG] using github.com/zclconf/go-cty v1.14.1
2023-11-05T13:10:26.038+0100 [INFO]  Go runtime version: go1.21.3
2023-11-05T13:10:26.038+0100 [INFO]  CLI args: []string{"tofu", "apply"}
2023-11-05T13:10:26.038+0100 [TRACE] Stdout is a terminal of width 119
2023-11-05T13:10:26.038+0100 [TRACE] Stderr is a terminal of width 119
2023-11-05T13:10:26.038+0100 [TRACE] Stdin is a terminal
2023-11-05T13:10:26.038+0100 [DEBUG] Attempting to open CLI config file: /Users/scorpil/.tofurc
2023-11-05T13:10:26.038+0100 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2023-11-05T13:10:26.039+0100 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2023-11-05T13:10:26.039+0100 [DEBUG] ignoring non-existing provider search directory /Users/scorpil/.terraform.d/plugins
2023-11-05T13:10:26.039+0100 [DEBUG] ignoring non-existing provider search directory /Users/scorpil/Library/Application Support/io.terraform/plugins
2023-11-05T13:10:26.039+0100 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2023-11-05T13:10:26.039+0100 [DEBUG] Found the config directory: /Users/scorpil/.terraform.d
2023-11-05T13:10:26.039+0100 [INFO]  CLI command args: []string{"apply"}
2023-11-05T13:10:26.040+0100 [TRACE] Meta.Backend: built configuration for "http" backend with hash value 3307601501
2023-11-05T13:10:26.040+0100 [TRACE] Preserving existing state lineage "62c5680d-ef48-1959-4f04-98b6c444f335"
2023-11-05T13:10:26.040+0100 [TRACE] Preserving existing state lineage "62c5680d-ef48-1959-4f04-98b6c444f335"
2023-11-05T13:10:26.041+0100 [TRACE] Meta.Backend: working directory was previously initialized for "http" backend
2023-11-05T13:10:26.041+0100 [TRACE] Meta.Backend: using already-initialized, unchanged "http" backend configuration
2023-11-05T13:10:26.042+0100 [TRACE] Meta.Backend: instantiated backend of type *http.Backend
2023-11-05T13:10:26.042+0100 [DEBUG] checking for provisioner in "."
2023-11-05T13:10:26.042+0100 [DEBUG] checking for provisioner in "/Users/scorpil/.bin"
2023-11-05T13:10:26.042+0100 [TRACE] Meta.Backend: backend *http.Backend does not support operations, so wrapping it in a local backend
2023-11-05T13:10:26.042+0100 [INFO]  backend/local: starting Apply operation
2023-11-05T13:10:26.043+0100 [TRACE] backend/local: requesting state manager for workspace "default"
2023-11-05T13:10:26.043+0100 [TRACE] backend/local: requesting state lock for workspace "default"
2023-11-05T13:10:26.043+0100 [DEBUG] POST https://gitlab.com/api/v4/projects/51883477/terraform/state/local2/lock
2023-11-05T13:10:26.043+0100 [ERROR] POST https://gitlab.com/api/v4/projects/51883477/terraform/state/local2/lock request failed: Post "https://gitlab.com/api/v4/projects/51883477/terraform/state/local2/lock": context deadline exceeded
╷
│ Error: Error acquiring the state lock
│
│ Error message: Failed to lock: POST https://gitlab.com/api/v4/projects/51883477/terraform/state/local2/lock giving
│ up after 1 attempt(s): context deadline exceeded
│
│ OpenTofu acquires a state lock to protect the state from being written
│ by multiple users at the same time. Please resolve the issue above and try
│ again. For most commands, you can disable locking with the "-lock=false"
│ flag, but this is not recommended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment