How to reference variables in destroy-time provisioner in Terraform?
Are you using a local-exec provisioner to run upon destruction with a
clause when = destroy
and getting this error message:
Destroy-time provisioners and their connection configurations may only reference attributes of the related resource, via ‘self’, ‘count.index’, or ‘each.key’.
A workaround is to use triggers, so your code would like this:
Instead of this: