# The correct form: stash the value in `input`, read it back via self.input.*
# in the destroy provisioner.
variable "target" {
  type    = string
  default = "host"
}

resource "terraform_data" "fine" {
  input = {
    target = var.target
  }

  provisioner "local-exec" {
    when    = destroy
    command = "echo ${self.input.target}"
  }
}
