terraform destroy specific instance with index value deleting all DNS record sets
rayuduc opened this issue · 1 comments
rayuduc commented
Hello,
Thanks for the google compute module, this is really cool stuff!!
Here am struck with some issue, when we create VM's with dns_record_name as hostname its able to create all host names with respective internal ip address, but when we destroy single instance from count of x, its deleting all DNS records,
Is there anyway if destroy single instance and should delete respective DNS record instead delete all instances DNS record sets?
terraform destroy -target="module.testing-vm.google_compute_instance.instances[1]"
resource "google_dns_record_set" "dns_record" {
count = var.amount
name = "${google_compute_instance.node.*.name[count.index]}.${var.dns_zone}"
#name = "${format("%s%02d", var.dns_record_name, count.index + 1)}.${var.dns_zone}"
#name = "${var.name}.${var.dns_zone}"
#name = "${google_compute_instance.node.*.name[count.index]}.${var.dns_zone}"
managed_zone = "${var.dns_name}"
type = "A"
ttl = 300
#rrdatas = ["${google_compute_instance.node.*.network_interface.0.network_ip}"]
rrdatas = ["${google_compute_instance.node.*.network_interface.0.network_ip[count.index]}"]
Thanks in advance!!
Eimert commented
Hi rayuduc,
Thank you for the compliment :). Apologies for my late response. Unfortunately I didn't find time to find a solution. I hope the community can assist.