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

provider/powerdns: Add support for PowerDNS 4 API #7819

merged 7 commits into from Jul 28, 2016


Copy link

commented Jul 26, 2016

This adds support for the non-experimental API present in PowerDNS 4, while retaining support for 3.X, with minimal changes.


  • I left the acceptance tests alone in this PR, but by add a trailing . to all DNS names (including in the records), they all succeeded against an actual 4.0.0 server
  • I noted an edge case regarding case sensitivity, but refrained from trying to fix it, since it's not clear which records and/or situations it effects.

If the plan is to drop 3.X entirely, I don't mind fixing those two things up, but that's not a decision I wanted to make alone.

Fixes #6056

@smuth4 smuth4 changed the title Add support for PowerDNS 4 provider/powerdns: Add support for PowerDNS 4 API Jul 26, 2016


This comment has been minimized.

Copy link

commented Jul 28, 2016

Hi @smuth4

Thanks for the work here - will this PR allow the PowerDNS provider to work with both 3 and 4 version servers?



This comment has been minimized.

Copy link
Contributor Author

commented Jul 28, 2016

@stack72 Yes, I ran the acceptance tests against a version 3 server to make sure. There are a few differences in the 4.X API that it doesn't handle automagically, but it is API-compatible with both versions.


This comment has been minimized.

Copy link

commented Jul 28, 2016

Hi @smuth4

Ok, I have also tested this ran against out current test framework for PowerDNS :)

% make testacc TEST=./builtin/providers/powerdns TESTARGS='-run=TestAccPDNS'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
TF_ACC=1 go test ./builtin/providers/powerdns -v -run=TestAccPDNS -timeout 120m
=== RUN   TestAccPDNSRecord_A
--- PASS: TestAccPDNSRecord_A (0.06s)
=== RUN   TestAccPDNSRecord_WithCount
--- PASS: TestAccPDNSRecord_WithCount (0.08s)
=== RUN   TestAccPDNSRecord_AAAA
--- PASS: TestAccPDNSRecord_AAAA (0.05s)
=== RUN   TestAccPDNSRecord_CNAME
--- PASS: TestAccPDNSRecord_CNAME (0.06s)
=== RUN   TestAccPDNSRecord_HINFO
--- PASS: TestAccPDNSRecord_HINFO (0.06s)
=== RUN   TestAccPDNSRecord_LOC
--- PASS: TestAccPDNSRecord_LOC (0.05s)
=== RUN   TestAccPDNSRecord_MX
--- PASS: TestAccPDNSRecord_MX (0.09s)
=== RUN   TestAccPDNSRecord_NAPTR
--- PASS: TestAccPDNSRecord_NAPTR (0.05s)
=== RUN   TestAccPDNSRecord_NS
--- PASS: TestAccPDNSRecord_NS (0.06s)
=== RUN   TestAccPDNSRecord_SPF
--- PASS: TestAccPDNSRecord_SPF (0.18s)
=== RUN   TestAccPDNSRecord_SSHFP
--- PASS: TestAccPDNSRecord_SSHFP (0.06s)
=== RUN   TestAccPDNSRecord_SRV
--- PASS: TestAccPDNSRecord_SRV (0.06s)
=== RUN   TestAccPDNSRecord_TXT
--- PASS: TestAccPDNSRecord_TXT (0.06s)
ok   0.931s

Thanks so much for the work here ! LGTM so merging

@stack72 stack72 merged commit bbd9b2c into hashicorp:master Jul 28, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

This comment has been minimized.

Copy link

commented Aug 2, 2016

Thanks @smuth4 I've been waiting for this PR for quite some time now and this will address a lot of my infra build with PDNS 4.x

Much appreciated.

@@ -111,6 +124,26 @@ func parseId(recId string) (string, string, error) {

// Detects the API version in use on the server

This comment has been minimized.

Copy link

linuxus Aug 23, 2016

This piece of code is breaking my .tf deployment as it tries to detect the API version before we launch the instance where PDNS is going to be hosted: here is my provider's config and you can see that my powerdns_server_url link is a place holder of a resource that will be created:

# Power DNS Provider
provider "powerdns" {
  api_key    = "${var.pdns_api_key}"
  #server_url = "http://${openstack_compute_instance_v2.admin_node.floating_ip}:8081"

obviously my terraform plan is failing with:
Error refreshing state: 1 error(s) occurred:

* Error setting up PowerDNS client: Error during parsing request URL: parse http://${openstack_compute_instance_v2.admin_node.floating_ip}:8081/api/v1/servers: invalid character "{" in host name

Wouldn't be better to check the server API version prior creating the records?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.