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

dme_dns_record not updating CNAME record for already-existent record on domain #20

Open
jimrubenstein opened this issue Jul 30, 2020 · 0 comments

Comments

@jimrubenstein
Copy link

jimrubenstein commented Jul 30, 2020

Terraform Version

Terraform v0.12.29

  • provider.aws v2.70.0
  • provider.dme v0.1.1

Affected Resource(s)

  • dme_dns_record

Terraform Configuration Files

provider "dme" {
	api_key = "apiKey"
	secret_key = "apiSecret"
	insecure = false
}

data "dme_domain" "domain_com" {
	name = "example.com"
}

resource "dme_dns_record" "web" {
	domain_id = data.dme_domain.domain_com.id
	name = "test"
	type = "CNAME"
	value = "www.google.com."
	ttl = 300
}

Debug Output

Relevant part of the debug log pasted here:

https://gist.github.com/jimrubenstein/9e326175b1093c1bb38ced0f526ace79

Panic Output

N/A

Expected Behavior

I would expect one of two things to happen

  1. Provider recognizes CNAME record exists already, and uses API to update it in-place using a PUT request on the api
  2. Provider recognizes CNAME record exists already, and issues a Destroy and subsequent Create.

If intended behavior is to not overwrite records, by default, an additional input on the dme_dns_record signaling a forced overwrite is okay, would be useful to facilitate the above behavior.

Actual Behavior

Provider attempts to POST request to API (which is the CREATE) action on the API and is treated differently than an UPDATE (PUT HTTP verb), which is what causes the error.

Steps to Reproduce

  1. Create conflicting CNAME record on a DOMAIN in your DNS Made Easy panel (test.example.com)
  2. Modify config to reflect correct API key and secret, update dme_domain domain name
  3. terraform apply

Important Factoids

This is a pared down, contrived, version of my terraform definition. Have confirmed this behavior with the, exact, above-pasted configuration (with my own domain name, obviously).

Also, I realize terraform doesn't touch things it doesn't know about. But, given the ethos that terraform isn't an all-or-nothing endeavor and we're trying to iteratively adopt it into our infrastructure, I need a way to either overwrite an existing CNAME record, or a feasible way to IMPORT a record into my tfstate.

References

N/A

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

1 participant