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

Initial SOA records conflicting with `INCEPTION-INCREMENT`

Open c33s opened this issue 5 years ago • 2 comments

to create a SOA record for a domain i have to use powerdns_record like this:

resource "powerdns_record" "SOA_example_com" {
  zone    = "example.com."
  name    = "example.com."
  type    = "SOA"
  ttl     = 3600
  records = ["dns1.example2.com. hostmaster.example.com. 2019120101 10800 3600 3600000 3600"]
}

which creates a record with this entry. if i have set my soa_edit_api to empty according #29 it works like charm but of course it is much better to have set the serial automatically. so if i set soa_api_edit to INCEPTION-INCREMENT i get a conflict because the serial got increased automatically and isn't equal to the serial set in the terraform config before:

  • running terraform apply creates the soa record (with the config above)
  • the serial gets increased automatically
  • running terraform apply again results in this:
      id:                 "example.com.:::SOA" => <computed> (forces new resource)
      name:               "example.com." => "example.com."
      records.#:          "1" => "1"
      records.xxxxxxxxx9: "ns1.example2.com. hostmaster.example.com. 2019120102 10800 3600 3600000 3000" => "" (forces new re
      records.xxxxxxxxx2: "" => "ns1.example2.com. hostmaster.example.com. 2019120101 10800 3600 3600000 3000" (forces new re
      ttl:                "3600" => "3600"
      type:               "SOA" => "SOA"
      zone:               "example.com." => "example.com."

so how to use this provider to create an initial SOA record but increase the serial without this conflict?

c33s avatar Dec 01 '19 21:12 c33s

maybe this would be an own ticket or its a reopen of #29 or its ok to put it here:

  • having setup a soa record for example domain with terraform
  • terraform apply runs with no errors or actions
  • add a new record to an non-existing domain (made a typo) where soa-edit-api is set to INCEPTION-INCREMENT
  • running terraform apply results in Failed to create PowerDNS Record: Error creating record set: example_com.:::MX, reason: "Could not find domain 'example_com.'" which is correct because of the typo
  • fixing the typo -> example_com -> example.com
  • terraform apply results in the error fo #29 (see below)
-/+ powerdns_record.SOA_example_com (new resource required)
id:                 "example.com.:::SOA" => <computed> (forces new resource)
name:               "example.com." => "example.com."
records.#:          "1" => "1"
records.2145257032: "dns1.example2.com. hostmaster.example.com. 2019120202 10800 3600 3600000 3000" => "" (forces new resource)
records.2374626224: "" => "dns1.example2.com. hostmaster.example.com. 2019120102 10800 3600 3600000 3000" (forces new resource)
ttl:                "3600" => "3600"
type:               "SOA" => "SOA"
zone:               "example.com." => "example.com."
* powerdns_record.SOA_example_com (destroy): 1 error(s) occurred:

* powerdns_record.SOA_example_com: Error deleting PowerDNS Record: Error deleting record: example.com. SOA, reason: "No SOA found for domain 'example.com.'"
* powerdns_record.MX_example_com: 1 error(s) occurred:

* powerdns_record.MX_example_com: Failed to create PowerDNS Record: Error creating record set: example.com.:::MX, reason: "No SOA found for domain 'example.com.'"

i have to connect to powerdns and change the soa-edit for the domain to '' and rerun terraform apply

shouldn't the soa record be set via powerdns_zone and such conflicts handled in the provider?

c33s avatar Dec 02 '19 12:12 c33s

Would it make sense to support a special SOA serial such as 0 one could use in combination with soa-edit-api which will override the serial anyway? The provider would just need to ignore changes to it if the resource uses the special value.

ion1 avatar Jul 17 '20 22:07 ion1