简体   繁体   中英

Delay of 10mn between resource creation with Terraform Vsphere provider

Is there a way to delay module resource creation with the Terraform Vsphere provider. I want to introduce a 10mn delay due to infrastructure impediments between each VM instance creation. Each one is created by a module occurrence.

At the moment, Terraform is doing its best to deploy at maximum speed!

I tried depends_on with module: no way.

Versions used:

vsphere 6.0
terraform 0.11.3
provider.vsphere v 1.3.2

You could use a provisioner within the instance and have some kind of sleep command there, before the next VM instance is created.

resource "vsphere_virtual_machine" "vpshere_build_machine" {
  provisioner "local-exec" {
      command = "ping 127.0.0.1 -n 10 > nul" #or sleep 10
  }

In my case I could solve it by doing this trick:

"sleep [s] && command"

For example:

provisioner "local-exec" {
    command = "sleep 30 && ansible-playbook -i ..."
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM