Search code examples
terraform

Abort and resume terraform apply


Some resources create a very long timespan, up to hours, to be created. I would like to use terraform in a ci deployment pipeline, but I want to prevent running the job for like 8 hours just waiting for resource creation.

Is it possible to pause/abort terraform execution and resync the state at a later time, for example 24 hours after each run.

The problem in my case is creating a azure cdn endpoint with cdn managed tls.


Solution

  • It is not possible to pause a Terraform Apply. You can only discard a run, but it will send a SIGINT to providers and they will handle the cancelation, mostly they will stop the process of creating the resources. As a workaround for this, you can split your project into multiple terraform workspaces. With that approach, you will not block other resources, by long-running Terraform Apply on the Azure CDN service.