Closed displague closed 4 years ago
I dressed this up as follows:
diff --git a/04-esx-hosts.tf b/04-esx-hosts.tf
index 7007d3a..d90acec 100644
--- a/04-esx-hosts.tf
+++ b/04-esx-hosts.tf
@@ -12,7 +12,7 @@ resource "packet_device" "esxi_hosts" {
ip_address {
type = "public_ipv4"
cidr = 29
- reservation_ids = [element(packet_reserved_ip_block.esx_ip_blocks.*.id, count.index)]
+ reservation_ids = try([element(packet_reserved_ip_block.esx_ip_blocks.*.id, count.index)], null)
}
ip_address {
type = "private_ipv4"
And was then able to terraform refresh
.
I haven't thought through whether or not this is a suitable value under this condition. I was able to destroy the resources afterward.
Closing this, but we may want to revisit this solution if others report this problem.
After a failed provision, the index on reserved IP blocks can reference an invalid index, preventing
terraform destroy
from succeeding.