Usage
Description
Theforce-unlock command releases a state lock that was not properly released. This can happen when a Terraform operation is interrupted or crashes.
Arguments
| Argument | Description |
|---|---|
stack | Stack name (optional, uses first stack if omitted) |
lock-id | The lock ID to release (required) |
Options
| Option | Type | Description | Default |
|---|---|---|---|
--output | string | Output directory | cdktf.out |
--force, -f | boolean | Skip confirmation prompt | false |
Examples
Basic Usage
Specific Stack
Force Without Confirmation
When to Use
You typically need this command when you see an error like:Safety
Only useforce-unlock when you’re certain no other Terraform operations are running. Forcing an unlock while another operation is in progress can corrupt your state.
Before using force-unlock:
- Verify no other team members are running Terraform
- Check for any stuck CI/CD pipelines
- Wait a few minutes for any in-progress operations to complete