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
merged 7 commits into from
Jul 28, 2016

Conversation

smuth4
Copy link
Contributor

@smuth4 smuth4 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.

Notes:

  • 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
@stack72
Copy link
Contributor

stack72 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?

Paul

@stack72 stack72 added the waiting-response An issue/pull request is waiting for a response from the community label Jul 28, 2016
@smuth4
Copy link
Contributor Author

smuth4 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.

@stack72
Copy link
Contributor

stack72 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)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/powerdns   0.931s

Thanks so much for the work here ! LGTM so merging

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

linuxus 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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@ghost
Copy link

ghost commented Apr 23, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement provider/powerdns waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PowerDNS provider changed for version 4.0.0(Alpha2) ttl key moved outside of the record
3 participants