Hi Team,
I am migrating my terraform from 0.11 to 0.12,
I am using local-exec in my ec2 on destroy.
provisioner "local-exec" {
command = self.private_ip
interpreter = ["powershell.exe", "-Command", "&{${element(data.template_file.aws_ondestroy.*.rendered, count.index)}}", "-ComputerIp"]
when = destroy
}
I am getting below warning, I have gone through below issue: https://github.com/hashicorp/terraform/issues/23679
and other links also … but I don’t see any solution for this.
Warning: External references from destroy provisioners are deprecated
on main.tf line 147, in resource "aws_instance" "self":
147: interpreter = ["powershell.exe", "-Command", "&{${element(data.template_file.aws_ondestroy.*.rendered, count.index)}}", "-ComputerIp"]
Destroy-time provisioners and their connection configurations may only
reference attributes of the related resource, via 'self', 'count.index', or
'each.key'.
References to other resources during the destroy phase can cause dependency
cycles and interact poorly with create_before_destroy.
Kindly share me the link if it is fixed.
Thanks