How do I get interrupt execution results and then resume apply

When I apply, ctrl c runs this time, can I get the result of this execution and then resume apply? For example, if I create a resource a that depends on b, c, b and c have been created, the terraform was interrupted during the creation of A due to special circumstances. Can I restore the creation of a separately before creating b and c

Hi @carrymec,

When Terraform receives an interrupt signal for the first time it will ask all providers to halt their current operations as soon as possible and then, once they gave concluded, will write the resulting partial state to your configured state storage. As long as the providers are all implemented correctly they should then be able to resume from that incomplete state on the next plan.

If you send Terraform two interrupt signals then the second one will cause Terraform to immediately abort without waiting for anything else to complete first. In that case you will probably have an incomplete state and so you will need to do some manual repair before continuing. It’s best to avoid doing this unless there’s no other option.

Hi @apparentlymart,

Could you elaborate on the following part:

will write the resulting partial state to your configured state storage.

As far as I’ve experimented, one interrupt signal during resource creation will not do anything
but wait until that ‘create’ is complete (as usual), and stop the rest of the run afterwards (not create any other resources defined in the plan).

Is this what you mean with partial state?
eg. you have a plan with 5 resources and an interrupt is triggered during creation of the third, you will have a state with 3 out of the 5 requested resources and the next run would just create the last 2 resources.

Hi @mapi,

I was referring to the behavior implemented here:

When Terraform receives a cancellation signal (which includes SIGINT, Ctrl+C) it prints the message about it “stopping” and then immediately asks the state manager to persist whatever is the latest snapshot of state in memory, before then asking Terraform Core to gracefully shut down.