aequitas / terraform-provider-transip

Terraform provider to manage Transip resources
https://registry.terraform.io/providers/aequitas/transip/latest/docs
MIT License
35 stars 16 forks source link

SOAP fault 26 when updating multiple DNS addresses #8

Closed Requinard closed 4 years ago

Requinard commented 4 years ago

I'm usinging a counted resource to create a bunch of DNS records. However, when applying changes, terraform will return a SOAP fault 26.

When I look at the control panel, I can see that it has only created a single record. Subsequent applies will keep creating a single record and failing on the rest.

data "transip_domain" "domain" {
  count = local.domains_count
  name = var.domains[count.index][1]
}

resource "transip_dns_record" "mail_ipv4" {
  count = local.domains_count
  domain = data.transip_domain.domain[count.index].id
  name = var.domains[count.index][0]
  type = "A"
  content = [hcloud_server.email.ipv4_address]
}

resource "transip_dns_record" "mail_mx" {
  count = local.domains_count
  domain = data.transip_domain.domain[count.index].id
  name = var.domains[count.index][0]
  type = "MX"
  content = ["10 ${var.base_email_domain}"]
}

It returns the following error

lan: 3 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

transip_dns_record.mail_mx[2]: Creating...
transip_dns_record.mail_mx[1]: Creating...
transip_dns_record.mail_spf[1]: Creating...
transip_dns_record.mail_mx[2]: Creation complete after 6s [id=kinksha.me/MX/dont]

Error: Provider produced inconsistent result after apply

When applying changes to transip_dns_record.mail_spf[1], provider
"registry.terraform.io/-/transip" produced an unexpected new value for was
present, but now absent.

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Error: failed to update DNS entries for domain kinksha.me: SOAP Fault 26: 

  on maildns.tf line 19, in resource "transip_dns_record" "mail_mx":
  19: resource "transip_dns_record" "mail_mx" {
Requinard commented 4 years ago

The domains is a list of tuples, so

[["@", "domain.com"], ["mail"."domain.com"]

aequitas commented 4 years ago

I'm currently in the process of reworking the implementation to the new REST api which supports adressing individual records better than the SOAP API did. If you can wait a few days I'll have a version up you can test.

Requinard commented 4 years ago

Thanks for the effort, I'd be happy test it for you.

I'd help developing but I'm need to get some experience with go first.

aequitas commented 4 years ago

https://github.com/aequitas/terraform-provider-transip/pull/10

aequitas commented 4 years ago

The problem you're facing probably persist in the new REST API as well as far as I could test. But running with -parallelism=1 should work around the problem until I've done some more investigation. This solution could work for both the old and the new version of this provider. Please reopen the issue if the problem persists with this workaround.