2019-12-03 19:23:07 +01:00
|
|
|
locals {
|
|
|
|
user = "name"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "null_resource" "a" {
|
|
|
|
connection {
|
|
|
|
host = self.hostname
|
|
|
|
user = local.user # WARNING: External references from destroy provisioners are deprecated
|
|
|
|
}
|
|
|
|
|
|
|
|
provisioner "remote-exec" {
|
|
|
|
when = destroy
|
|
|
|
index = count.index
|
|
|
|
key = each.key
|
2020-01-15 17:39:01 +01:00
|
|
|
|
|
|
|
// path and terraform values are static, and do not create any
|
|
|
|
// dependencies.
|
2020-01-13 22:44:44 +01:00
|
|
|
dir = path.module
|
2020-01-15 17:39:01 +01:00
|
|
|
workspace = terraform.workspace
|
2019-12-03 19:23:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "null_resource" "b" {
|
|
|
|
connection {
|
|
|
|
host = self.hostname
|
|
|
|
# this is OK since there is no destroy provisioner
|
|
|
|
user = local.user
|
|
|
|
}
|
|
|
|
|
|
|
|
provisioner "remote-exec" {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "null_resource" "b" {
|
|
|
|
provisioner "remote-exec" {
|
|
|
|
when = destroy
|
|
|
|
connection {
|
|
|
|
host = self.hostname
|
|
|
|
user = local.user # WARNING: External references from destroy provisioners are deprecated
|
|
|
|
}
|
|
|
|
|
|
|
|
command = "echo ${local.name}" # WARNING: External references from destroy provisioners are deprecated
|
|
|
|
}
|
|
|
|
}
|