Good morning,
I am trying to run a null_resource with a remote-exec only in ondestroy,
I’m trying to execute a null_resource with a remote-exec only in ondestroy, but it’s impossible.
My code:
resource "null_resource" "remove-user-gitlab-runners" {
connection {
type = "ssh"
user = var.remote_user
password = var.password
private_key = file(var.private_key_path)
host = var.remote_host
}
provisioner "remote-exec" {
when = destroy
inline = [
"echo 'Unregistering GitLab Runner...'",
"gitlab-runner unregister --all-runners",
"pkill process",
]
}
}
Can I do it?