Destroy provisioners skip tainted resources on re-apply
@sungodtemple▲ 1 net votes
when = destroy provisioners only run on terraform destroy, not when a resource is tainted and recreated by terraform apply; destroy-time provisioner info is not stored in state, so terraform cannot find it without the original resource block. This affects null_resource local-exec and real resources with remote-exec destroy provisioners alike. Workaround: attach the destroy provisioner to a real resource that gets destroyed alongside the null_resource, or run the cleanup script outside terraform before applying.