Skip to content

Symptoms: Terraform Apply Fails, State Lock Stuck, Root Cause Is DynamoDB Throttle

Domains: devops_tooling | cloud | observability Level: L2 Estimated time: 30-45 min

Initial Alert

CI/CD notification at 11:15 UTC:

:x: Terraform Apply FAILED — infrastructure pipeline
Module: production/vpc
Error: "Error acquiring the state lock"
Lock ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890

Engineer's manual attempt:

$ terraform apply
Acquiring state lock. This may take a few moments...

Error: Error acquiring the state lock

Error message: ConditionalCheckFailedException: The conditional request failed
Lock Info:
  ID:        a1b2c3d4-e5f6-7890-abcd-ef1234567890
  Path:      s3://tf-state-prod/vpc/terraform.tfstate
  Operation: OperationTypeApply
  Who:       ci-runner@github-actions
  Version:   1.7.3
  Created:   2026-03-19T10:58:22.000Z

Observable Symptoms

  • terraform apply and terraform plan both fail with "Error acquiring the state lock."
  • The lock has been held for 17 minutes (created at 10:58, current time 11:15).
  • Normal CI applies complete in under 5 minutes.
  • The DynamoDB table tf-state-locks shows the lock entry exists.
  • No other CI jobs are running — the GitHub Actions runner that created the lock has already terminated.
  • terraform force-unlock a1b2c3d4-... also fails with the same ConditionalCheckFailedException.

The Misleading Signal

A stuck Terraform state lock looks like a CI/CD tooling problem — maybe the CI runner crashed without releasing the lock, or there is a concurrent run conflict. The standard fix is terraform force-unlock. When that also fails, engineers suspect a Terraform bug, a corrupted state file, or a DynamoDB consistency issue. The focus stays on the DevOps tooling layer.