Pausing apply runs when applying modules

Hi,

Is there a possibility to pause after a module is applied and get the output data before proceeding to the next module ?

I would like pause on 1st run since the module creates keys that i need for another tool. If it keys are created then it could skip the pause on the 2nd run

Kevin

Do you mean pause like a wait/depends-on something?
As in, “wait for this external service to do its magic, then resume”?

Or a pause like “if condition met, pause execution until a human hits resume”?

Hi Mikegreen,

It is more like “if condition met, pause execution until a human hits resume”?. The Use case is the terraform module creates TLS Pvt key and Certs. Which i would like the operator to save it to be used by the external tool. Once he has kept the things ready . He could continue the terrafrom apply for the remaining modules for the 1st run. For the 2nd run it could be skipped, since the operator has already done the process .

Kevin

I’ve heard of that before, but never seen a GH issue logged… Doesn’t exist now, but I think it’d be a worthy addition to request and see what community support it can get.

Hi @linuxbsdfreak,

With Terraform as it exists today, this sort of use-case is typically met by decomposing the problem into two configurations and then applying them in sequence:

  • Apply configuration 1
  • Do whatever you need to do to decide whether to apply configuration 2
  • Apply configuration 2

In this situation configuration 1 will typically publish some of its results in a location where configuration 2 can subsequently retrieve them using data sources.

Teams with this sort of requirement will then typically run Terraform in automation in order to help orchestrate the process and make sure it is followed correctly each time.

Since your variant of the problem involves an interactive approval step, that suggests you’d either use a local script that can prompt interactively in a shell, or to use a workflow automation system that has the possibility of interactively prompting for more data in the middle of a pipeline. There are a number of automation systems with that capability, but just as an example of what I mean see Jenkins’s “Input Step”.

Hello @linuxbsdfreak,

I would also recommend taking a look at the depends_on option when working with your infrastructure as it can be helpful with specifying the order of which Terraform objects get created and when.

https://www.terraform.io/docs/configuration/resources.html#depends_on-explicit-resource-dependencies

Sincerely,

Taylor Dolezal