hashicorp / terraform-provider-dyn

Terraform Dyn provider. Please note: This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
https://registry.terraform.io
Mozilla Public License 2.0
7 stars 16 forks source link

dyn_record: won't manage a TXT record without a name set #3

Closed hashibot closed 7 years ago

hashibot commented 7 years ago

This issue was originally opened by @mdkent as hashicorp/terraform#8944. It was migrated here as part of the provider split. The original body of the issue is below.


Having some issues trying to manage a TXT record on a top level domain.

Terraform Version

Terraform v0.7.3

Affected Resource(s)

resource "dyn_record" "spf" {
  zone  = "test.com"
  name  = ""
  value = "v=spf1 include:_spf.test.com include:amazonses.com -all"
  type  = "TXT"
  ttl   = 300
}

Expected Behavior

Terraform creates a TXT record on test.com and doesn't attempt to set it on a subsequent run.

Actual Behavior

Plan:

+ dyn_record.spf
    fqdn:  "<computed>"
    ttl:   "300"
    type:  "TXT"
    value: "v=spf1 include:_spf.test.com include:amazonses.com -all"
    zone:  "test.com"

Plan: 1 to add, 0 to change, 0 to destroy.

which is already incorrect, the record exists in dyn.

Apply:

Terraform v0.7.3

Setting up remote state...
Downloading remote modules...
Refreshing Terraform state prior to plan...
dyn_record.spf: Creating...
  fqdn:  "" => "<computed>"
  ttl:   "" => "300"
  type:  "" => "TXT"
  value: "" => "v=spf1 include:_spf.test.com include:amazonses.com -all"
  zone:  "" => "test.com"
Error applying plan:

1 error(s) occurred:

* dyn_record.spf: Failed to create Dyn record: Bad response, got "400 Bad Request"

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

The documentation on https://www.terraform.io/docs/providers/dyn/r/record.html doesn't make mention of setting name to an empty string to add records to the tld, maybe this isn't well tested?

I've also tried modifying an A record on the domain without success.

There's a chance this may be a permissions issue with my API user, but it's seemingly able to modify records below the top level domain just fine.

ipmb commented 7 years ago

Pretty sure this is a dupe of #6

radeksimko commented 7 years ago

@ipmb thanks for the ping - closing & labelling appropriately.

radeksimko commented 7 years ago

Duplicate of #6