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

powerdns_zone: kind is case sensitive #46

Closed
c33s opened this issue Dec 1, 2019 · 1 comment · Fixed by #58
Closed

powerdns_zone: kind is case sensitive #46

c33s opened this issue Dec 1, 2019 · 1 comment · Fixed by #58

Comments

@c33s
Copy link
Contributor

c33s commented Dec 1, 2019

the powerdns docs say that the type (=kind) should have MASTER or SLAVE in it for replication. i am not sure about the case of Native but with master and slave they are in caps.

https://doc.powerdns.com/authoritative/modes-of-operation.html#master-slave-setup-requirements

but setting the kind to MASTER

resource "powerdns_zone" "..." {
  name    = "example.com."
  kind    = "MASTER"
...

when calling terraform apply results everytime in:

  ~ powerdns_zone....
      kind: "Master" => "MASTER"

so you have to write Master to not get a diff on each terraform apply

@mbag
Copy link
Collaborator

mbag commented Dec 18, 2019

hi @c33s , thanks for the report. The problem is actually with PowerDNS API. It will accept any of the "MASTER", "Master", "master", or "maSTer" variants. So terraform will store this value in tfstate, because it was used to create a zone. But next time when terraform queries the API for the zone state, API will return "kind": "Master" (or Slave, or Native) and this is why terraform has diff on every plan/apply.

I started working on this issue and created a branch https://github.com/terraform-providers/terraform-provider-powerdns/tree/fix_kind_case_sensitive

The changes commited there amend case sensitivity, when comparing tfstate against values returend from API server. terraform apply will no longer create diff, based on case of the letters in kind. I tried compiling and using this version of the provider, and for example kind = "nATiVe" worked, when ran against PDNS server that can be spawn using docker-compose.yml (used for testing in this repo).

I need to figure out if there is a way to create terraform provider acceptance tests for this issue. If not, I'll just create tests using terraform command against spawned testing PowerDNS API server in .travis.yml.

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

Successfully merging a pull request may close this issue.

2 participants