Terraformexit code > 0

Error acquiring the state lock

$Error acquiring the state lock Error message: 2 errors occurred: * Resource '...' does not have attribute 'id' * Resource '...' does not have attribute 'type'

Analysis

Another process (or a previous crashed process) is holding a lock on the Terraform state file to prevent corruption.

Common Triggers

  • A CI/CD job was cancelled mid-run.
  • Another developer is running apply at the same time.

Debug Checks

  • $Check your CI/CD pipeline status.

Resolution

1
Wait for the other process.
2
Force unlock (CAREFUL): terraform force-unlock <lock_id>.

Metadata

Tool
Terraform
Severity
High
Tags
#terraform#iac#lock