-
Notifications
You must be signed in to change notification settings - Fork 10k
Closed as not planned
Labels
Description
Terraform Version
Terraform v1.11.4
on windows_386
+ provider registry.terraform.io/citrix/citrixadc v1.43.1
+ provider registry.terraform.io/hashicorp/null v3.2.4
Terraform Configuration Files
Note: this works fine in when=create
resource "terraform_data" "unbinds" {
for_each = local.unbinds
input = {
vservername = each.value.vservername
certkeyname = each.value.certkeyname
}
provisioner "local-exec" {
when = destroy
environment = {
TF_VSERVERNAME = self.input.vservername
TF_CERTKEYNAME = self.input.certkeyname
}
interpreter = ["powershell.exe","-Command"]
command = "&'${abspath(path.module)}/bin/cleanup.ps1 -v ${self.input.vservername} -c ${self.input.certkeyname}"
}
}
Debug Output
NA
Expected Behavior
the command should be executed upon destruction of the terraform_data instance.
Actual Behavior
The terraform_data resource gets destroyed but the command does not get executed. Note that the exact same block with when=create
does work fine.
Steps to Reproduce
create a terraform_data resource with a provisioner "local-exec" { when = destroy }
block
remove the resource and apply => resource gets destroyed without the script running
Additional Context
No response
References
No response
Generative AI / LLM assisted development?
No response