prudhvitella/terraform-provider-infoblox

Add support for host and ptr records, as well as obtain next available IP from CIDR.

Closed this issue · 7 comments

Hi,

just wanted to say that your infoblox provider worked great. I was able to get it running in a short amount of time, great ReadMe. I just moved into a coding role and have a need to extend the functionality to include Host and Ptr records as well as the ability to query infoblox for the next available IP based on the network CIDR block give in another provider. Would it be possible to work together to accomplish this?

Thanks,

Karlos

I won't be able to look at this for the next few days due to time constraints. However, it is fairly straightforward to add support for host and ptr records. Just use the existing records in the code and https://github.com/fanatic/go-infoblox repo as reference. Let me know if you get stuck or have questions.

For the ability to request next available IP address in a given CIDR block, are you looking to create IP address, hostname tuple records dynamically?

Hello, thanks for taking the time to reply.

Still new to coding, was just promoted to software development at the end of March, but willing to give it a shot.

You are correct, we automatically source IPs and register hostnames with infoblox during VM provisioning on VMware and looking for the same functionality with the terraform infoblox provider.

Happy to compensate you for teaching/mentoring me along in my coding journey.

Thanks again,

Karlos
kknox@snktech.net

Hi prudhvitella,

I am actually needing the same thing I think. Basically I need to be able to register a host and assign it an IP address on the fly. My understanding from here:

https://community.infoblox.com/t5/Security/Best-Practice-for-Reserving-IP-Address/td-p/989

is that this can be done in a single REST call to the record:a endpoint, with a particular parameter tacked on the end.

So, I cloned your code and started looking into what I need to change, but I haven't gotten very far yet. I'm also still a little fuzzy on how the terraform file would be written if you're using this hostname and returned IP address in another provider (VMWare for example).

I'm kind of a newbie to terraform.

I'll post back here with my progress, and if I get it working I'll fork and add a pull request.

@kknox-ea

I added the ability to acquire an IP address as a new resource to the infoblox provider. Unfortunately the pull request to merge my code back into @prudhvitella 's repository failed due to something that had nothing to do with anything I changed (I think it's broken somehow). So, near term you can go to my fork here:

https://github.com/calphool/terraform-provider-infoblox

See the bottom of the README.md for usage notes.

June 18, 2016 -- this is no longer necessary. Prudhitella merged my code into his here.

FYI, I'm digging into supporting HOST and PTR records now (now that my immediate need is taken care of -- getting next IP address). Unfortunately I don't really have a good way to test this stuff -- using a stubbed out fake version of Infoblox (a rest endpoint built with the ruby Sinatra framework). I know the IP address code works, but the HOST and PTR change will probably have to be contributed without testing against a real device.

Infoblox themselves make it hard to get access to documentation. I can't find a publically available set of documentation that shows REST responses for everything. I tried to register with them, but since I didn't have contract info they rejected my registration attempt. I've heard they're not in a great financial place right now (recently laid off 10% of their workforce)... maybe they should take a look at their customer service practices. I mean, for crying out loud, you've got people like prudhvitella and I trying to make their product more valuable in the marketplace by making it hook to Terraform, and they won't even make full REST endpoint documentation available for everyone without paying them a licensing contract for the privilege? Derp... that kind of thinking went out 10 years ago. Is their CEO stupid? /endrant

Hey Calphool, awesome work. thanks for sharing. I was out of the office for bit, but back working on this project. Hows the progress going on the HOST and PTR records?

Hi,

I've added some new functionality to the terraform-provider-infoblox plugin. It now uses JSON for the requests rather than URL parameters and supports host records, as well as getting the next available IP address in a single resource. I've also added some extra optional attributes such as comment, view, etc. E.g.

resource "infoblox_record" "foobar" {
    name = "terraform"
    domain = "mydomain.com"
    nextavailableip = true
    value = "192.168.0.0/24"
    type = "Host"
    comment = "Terraform test record"
}

Or to specify an IP address:

resource "infoblox_record" "foobar" {
    name = "terraform"
    domain = "mydomain.com"
    value = "192.168.0.10"
    type = "Host"
    comment = "Terraform test record"
}

I had to make some changes to fanatic's go-infoblox library to achieve this (which have now been merged). Prudhvitella - I'm happy to submit a PR to merge these changes in if they look good. The tests will need updating to reflect the changes, but most of these changes maintain compatibility with the original provider schema. It works well against our Infoblox Grid using terraform 0.7.0.

https://github.com/universityofderby/terraform-provider-infoblox

Thanks, Richard