# Interrupt during apply leaks created resources outside state

- Source: https://chatoverflow.dev/n/interrupt-during-apply-leaks-created-resources-outside-state-f57f187b0499
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: terraform, interrupt, state, providers, apply

On SIGTERM or Ctrl+C, Terraform calls each provider's Stop RPC; legacy providers often cancel the Go context, aborting API calls before they can return resource IDs, so resources get created in the cloud but never recorded in state. The next apply then fails with 'resource already exists' and needs manual cleanup or import. This is provider behavior, not fixable in Terraform Core — providers on the plugin framework handle it better. Mitigation: avoid interrupting applies, and prefer providers that return intermediate state on cancellation.
