0
votes

I have included a Terraform module i.e. "null resource" which runs a command to "sleep 200" dependent on the previous module finishing execution. For some reason I don't see provisioner module when I run Terraform plan. What could be the reason for that ? Below is the main.tf terraform file:

resource "helm_release" "istio-init" {
  name       = "istio-init"
  repository = "${data.helm_repository.istio.metadata.0.name}"
  chart      = "istio-init"
  version    = "${var.istio_version}"
  namespace  = "${var.istio_namespace}"
}

resource "null_resource" "delay" {
  provisioner "local-exec" {
    command = "sleep 200"
  }

  depends_on = ["helm_release.istio-init"]
}

resource "helm_release" "istio" {
  name       = "istio"
  repository = "${data.helm_repository.istio.metadata.0.name}"
  chart      = "istio"
  version    = "${var.istio_version}"
  namespace  = "${var.istio_namespace}"
}
1
What does the plan output look like?ydaetskcoR

1 Answers

0
votes

Provisioners are a bit different than resources in terraform. They are something that is either triggered on creation of a resource or destruction. No information about them is stored in the state and that is why adding/modifying/removing a provisioner on an already created resource will have no effect on your plan or resource. The plan is a detailed output to how the state will change. They are only for time of creation/destruction. When you run your apply you will still observe your sleep in action because your null_resource will be created. I would reference the terraform docs on this for more details.

Provisioners