terraform-provider-maas icon indicating copy to clipboard operation
terraform-provider-maas copied to clipboard

Domain fails to delete on teardown due to deleting dependent record in parallel

Open cpg1111 opened this issue 2 years ago • 0 comments

Given a Domain Resource and DNS Record Resource such as the following:

resource "maas_dns_domain" "tf_test_domain" {
    name = "tftest"
    ttl = 3600
    authoritative = true
}

resource "maas_dns_record" "tf_test_record" {
    type = "A/AAAA"
    data = "10.10.10.1"
    fqdn = "tftestrecord.${maas_dns_domain.tf_test_domain.name}"
}

The domain may fail to delete on teardown. This is due to the fact that the record must be deleted first, then the domain can be deleted, creation will work here because of the domain's name being interpolated causing Terraform to create the domain first, but on teardown, since there is no explicit dependency between the two expressed, they are deleted in parallel.

cpg1111 avatar Nov 22 '22 14:11 cpg1111