Interview Prep/Terraform/Partial Applies, Version Mismatches and CI Failures

Ctrl-C during an apply printed `Two interrupts received. Exiting immediately. Note that data loss may have occurred.`

AdvancedTroubleshootingPartial Applies, Version Mismatches and CI Failures
Answer

Likely causes → The first Ctrl-C asks Terraform to stop gracefully after in-flight operations; the second kills it. In-flight resources may exist in the cloud but not in state, and the lock may remain.

Diagnose →

terraform force-unlock <ID>    # only if the lock remains and nothing else runs
terraform plan                 # look for creates of things that already exist

Fix → Import any resources that exist but are missing from state; untaint or replace half-created ones.

Prevent → Press Ctrl-C once and wait. In CI, give jobs a graceful shutdown period.

All Terraform questions

More on Partial Applies, Version Mismatches and CI Failures