Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volterra provider attempting to delete dns_lb_pool before deleting dns_domain #187

Open
ghost opened this issue Feb 3, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 3, 2023

I'm using a DNS domain with a record that uses a lb_record type pointing to a DNS load balancer:

resource "volterra_dns_lb_health_check" "www-juiceshop-vip-health-check" {
  name      = "www-juiceshop-vip-health-check"
  namespace = "system"
  https_health_check {
    health_check_port = "443"
    receive           = ""
    send              = ""
  }
}

resource "volterra_dns_lb_pool" "www-juiceshop-vip" {
  name                = "www-juiceshop-vip"
  namespace           = "system"
  load_balancing_mode = "ROUND_ROBIN"

  a_pool {
    max_answers          = "1"
    health_check {
      name = "${volterra_dns_lb_health_check.www-juiceshop-vip-health-check.name}"
    }
    members {
        ip_endpoint = "${aws_eip.WestBIGIPDataEIP.public_ip}"
        priority    = "10"
        ratio       = "10"
      }
    members {
        ip_endpoint = "${aws_eip.EastBIGIPDataEIP.public_ip}"
        priority    = "10"
        ratio       = "10"
      }
  }
  use_rrset_ttl = true
}
resource "volterra_dns_load_balancer" "www-juiceshop-vip" {
  name        = "juiceshop-vip"
  description = "GSLB for www.juiceshop.vip"
  namespace   = "system"
  record_type = "A"
  rule_list {
    rules {
      pool {
        name      = "www-juiceshop-vip"
      }
      geo_location_label_selector {
        expressions = ["region in (us-west1, us-west2),tier in (staging)"]
      }
      score = "50"
    }
  }
}

resource "volterra_dns_zone" "juiceshop-vip" {
  name = "${var.labDomain}"
  namespace = "system"
  primary {
    rr_set_group {
      metadata {
        description = "Global DNS Names (GSLB)"
        disable = false
        name = "global"
      }
      rr_set {
        ttl = "60"
        lb_record {
          name = "www"
          value {
            name = "juiceshop-vip"
          }
        }
      }
    }
    rr_set_group {
      metadata {
        description = "West Region"
        disable = false
        name = "west"
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "www-west"
          values = ["${aws_eip.WestBIGIPDataEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "west-dns"
          values = ["${aws_eip.WestBIGIPServerEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "west-bigip"
          values = ["${aws_eip.WestBIGIPMgmtEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "west-server"
          values = ["${aws_eip.WestServerEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        aaaa_record {
          name = "west-server"
          values = ["${one(aws_network_interface.WestServerENI.ipv6_addresses)}"]
        }
      }
    }
    rr_set_group {
      metadata {
        description = "Management Hosts"
        disable = false
        name = "management"
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "netbox"
          values = ["${aws_eip.DockerEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "docker"
          values = ["${aws_eip.DockerEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "prometheus"
          values = ["${aws_eip.DockerEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "grafana"
          values = ["${aws_eip.DockerEIP.public_ip}"]
        }
      }
    }
    rr_set_group {
      metadata {
        description = "East Region"
        disable = false
        name = "east"
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "www-east"
          values = ["${aws_eip.EastBIGIPDataEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "east-dns"
          values = ["${aws_eip.EastBIGIPServerEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "east-bigip"
          values = ["${aws_eip.EastBIGIPMgmtEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        a_record {
          name = "east-server"
          values = ["${aws_eip.EastServerEIP.public_ip}"]
        }
      }
      rr_set {
        ttl = "60"
        aaaa_record {
          name = "east-server"
          values = ["${one(aws_network_interface.EastServerENI.ipv6_addresses)}"]
        }
      }
    }
  }
}

When I attempt to destroy the environment, I receive this error:

Error: Deleting object from api gateway: Unsuccessful DELETE at URL https://console.ves.volterra.io/api/public/namespaces/system/dns_lb_pools/www-juiceshop-vip, status code 400, body {"code":9,"details":[],"message":"Cannot delete a referenced object. Please remove reference from parent object(s) [volterra-jwmmveys/system/juiceshop-vip] of kind ves.io.schema.dns_load_balancer.Object."}, err %!s(<nil>)

If I delete the DNS domain manually, it completes normally. It looks like the provider is not deleting the DNS domain prior to deleting the pool.

@ghost
Copy link
Author

ghost commented Feb 3, 2023

As a workaround, I was able to use the depends_on operator for the volterra_dns_zone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants