github.com/hugorut/terraform@v1.1.3/src/terraform/testdata/apply-provisioner-destroy/main.tf (about)

     1  resource "aws_instance" "foo" {
     2      for_each = var.input
     3      foo = "bar"
     4  
     5      provisioner "shell" {
     6          command = "create ${each.key} ${each.value}"
     7      }
     8  
     9      provisioner "shell" {
    10          when = "destroy"
    11          command  = "destroy ${each.key} ${self.foo}"
    12      }
    13  }
    14  
    15  variable "input" {
    16    type = map(string)
    17    default = {}
    18  }