prudhvitella / terraform-provider-infoblox Goto Github PK
View Code? Open in Web Editor NEWInfoblox plugin for Terraform
License: Mozilla Public License 2.0
Infoblox plugin for Terraform
License: Mozilla Public License 2.0
Hi,
is there a way to support count loop returning more than one next available IP ?
I am aware that Infoblox API supports it (&num=X) https://community.infoblox.com/t5/API-Integration/Get-Next-Available-IP-and-Reserve/td-p/8548
my problem, I want to ask for the next X available IPs and create an A record for all of them.
On the example below in my case count = 4, but what happens is that I get 4x the same IP, instead of unique 4 next available IPs.
resource "infoblox_ip" "tunnel_ips" {
count = "4"
cidr = "192.168.0.0/16"
}
resource "infoblox_record" "vpn_host_internal" {
count = "4"
value = "${element(infoblox_ip.tunnel_ips.*.ipaddress, count.index)}"
name = "test-{count.index +1}"
domain = "acme.com"
type = "A"
ttl = 3600
}
I am providing a cidr of "10.193.3.0/24" to the infoblox_ip resource and am getting the following:
I see in the code that you print this error after this:
if len(network) == 0
I am not positive what is going into the 'network' variable, but if it is my cidr I am very confused.
Can you help me?
Hi,
Great work on this provider! I hit an issue with the PTR resource though. It doesn't seem to be idempotent. Every-time I run terraform plan/apply it wants to make a change. It seems like it may be similar to this issue #37
Terraform v0.11.10
This terraform-provider-infoblox: https://github.com/prudhvitella/terraform-provider-infoblox/releases/download/pre-release/linux_amd64_terraform-provider-infoblox
For example, this code:
resource "infoblox_record_ptr" "ptr" {
ptrdname = "vm02.domain.local"
name = "175.0.0.10.in-addr.arpa"
view = "default"
}
will result in this change everytime:
~ infoblox_record_ptr.ptr
name: "" => "175.0.0.10.in-addr.arpa"
Also, if I change from name to address value in the resource definition I get the following behavior.
resource "infoblox_record_ptr" "ptr" {
ptrdname = "vm02.domain.local"
address = "10.0.0.175"
view = "default"
}
This results in:
-/+ infoblox_record_ptr.ptr (new resource required)
id: "record:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5hcnBhLmluLWFkZHIuMTAuMTE2LjQuNDQuYTF2aXRzYmxkcjAyLnEyZGMubG9jYWw:175.0.0.10.in-addr.arpa/default" => <computed> (forces new resource)
address: "" => "10.0.0.175" (forces new resource)
ptrdname: "vm02.domain.local" => "vm02.domain.local"
view: "default" => "default"
Hello, when I attempt to update an A record, I get the following response. I built the provider with the latest source. Thanks for any help.
* infoblox_record_a.dev-cf41-test2-kafka1: error updating Infoblox A record: Error AdmConProtoError: Field is not allowed for update: view - Client.Ibap.Proto - Field is not allowed for update: view
Hi,
Would it be possible to document the installation procedure?
I tried to put the released binary in ~/.terraform.d/plugins/linux_amd64/linux_amd64_terraform-provider-infoblox, but terraform complains it cannot fing it as a provider:
$ terraform init
Initializing provider plugins...
- Checking for available provider plugins on https://releases.hashicorp.com...
Provider "infoblox" not available for installation.
A provider named "infoblox" could not be found in the official repository.
This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.
In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
terraform.d/plugins/linux_amd64
Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".
Any idea how to install the plugin properly?
Dear,
no way to get the next available IP from a network CIDR using
resource "infoblox_ip" "ip" { cidr = "172.16.8.0/24" }
I get this error:
infoblox_ip.ip: Creating...
cidr: "" => "172.16.8.0/24"
ipaddress: "" => "<computed>"
Error: Error applying plan:
1 error(s) occurred:
* infoblox_ip.ip: 1 error(s) occurred:
* infoblox_ip.ip: [ERROR] Empty response from client.Network().find. Is 172.16.8.0/24 a valid network?
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
but the network exist:
curl -k -u admin:passwd -X GET "https://infoblox/wapi/v2.9.1/network?_return_as_object=1"
{
"result": [
{
"_ref": "network/ZG5zLm5ldHdvcmskMTcyLjE2LjguMC8yNC8w:172.16.8.0/24/default",
"network": "172.16.8.0/24",
"network_view": "default"
}
]
Using:
resource "infoblox_ip" "ipAddressFromRange" {
ip_range = "172.16.8.5-172.16.8.10"
}
crashed terraform! See attachment crash.log for details.
Thanks.
I'm currently using Terraform v0.6.15. What terraform version is this plugin compatible with? Are there any releases that are compatible with newer versions of terraform?
Hello,
After a new Host record has just been created via a Terraform
template, if I were to run terraform plan
a second time a new set of changes is proposed.
Even after this extra change set has been applied, a subsequent terraform plan
produces the same changes yet again:
$ terraform plan
...
...
Terraform will perform the following actions:
~ module.testmodule.infoblox_record_host.myhost
ipv4addr.#: "2" => "1"
ipv4addr.0.address: "" => "10.10.10.10"
ipv4addr.0.configure_for_dhcp: "" => "false"
ipv4addr.0.mac: "" => "fa:16:3e:44:69:2b"
ipv4addr.1.address: "10.10.10.10" => ""
ipv4addr.1.configure_for_dhcp: "true" => "false"
ipv4addr.1.host: "myhost.example.com" => ""
ipv4addr.1.mac: "fa:16:3e:44:69:2b" => ""
ipv6addr.#: "1" => "0"
Plan: 0 to add, 1 to change, 0 to destroy.
$ terraform apply
...
...
ipv4addr.#: "2" => "1"
ipv4addr.0.address: "" => "10.10.10.10"
ipv4addr.0.configure_for_dhcp: "" => "false"
ipv4addr.0.mac: "" => "fa:16:3e:44:69:2b"
ipv4addr.1.address: "10.10.10.10" => ""
ipv4addr.1.configure_for_dhcp: "true" => "false"
ipv4addr.1.host: "myhost.example.com" => ""
ipv4addr.1.mac: "fa:16:3e:44:69:2b" => ""
ipv6addr.#: "1" => "0"
$ terraform plan
...
...
Terraform will perform the following actions:
~ module.testmodule.infoblox_record_host.myhost
ipv4addr.#: "2" => "1"
ipv4addr.0.address: "" => "10.10.10.10"
ipv4addr.0.configure_for_dhcp: "" => "false"
ipv4addr.0.mac: "" => "fa:16:3e:44:69:2b"
ipv4addr.1.address: "10.10.10.10" => ""
ipv4addr.1.configure_for_dhcp: "true" => "false"
ipv4addr.1.host: "myhost.example.com" => ""
ipv4addr.1.mac: "fa:16:3e:44:69:2b" => ""
ipv6addr.#: "1" => "0"
Plan: 0 to add, 1 to change, 0 to destroy.
The template:
resource "infoblox_record_host" "myhost" {
name = "${var.fqdn}"
view = "${var.dnsview}"
ipv4addr {
address = "${var.ipv4}"
mac = "${var.mac}"
configure_for_dhcp = false
}
}
NB: The number of IP addresses associated with the record is 1
, whereas the plugin seems to detect 2
in ipv4addr.#
.
I expect adding a new host record to be an idempotent operation given that no further changes are made to the given template and/or the infoblox record itself.
terraform plan
# infoblox_record_host.host will be created
+ resource "infoblox_record_host" "host" {
+ configure_for_dns = true
+ id = (known after apply)
+ name = "REDACTED"
+ view = "default"
+ ipv4addr {
+ address = (known after apply)
}
}
terraform apply
# infoblox_record_host.host will be created
+ resource "infoblox_record_host" "host" {
+ configure_for_dns = true
+ id = (known after apply)
+ name = "REDACTED"
+ view = "default"
+ ipv4addr {
+ address = (known after apply)
}
}
terraform plan
# infoblox_record_host.host will be updated in-place
~ resource "infoblox_record_host" "host" {
comment = ""
~ configure_for_dns = false -> true
id = "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5zdHRndHMuY2xvdWQubWxjMS5wMDEuc2Ft:REDACTED/default"
name = "REDACTED"
ttl = 0
view = "default"
~ ipv4addr {
address = "10.97.8.1"
configure_for_dhcp = false
mac = ""
}
}
debugging this using Postman, it appears for some reason that configure_for_dns
is not returned when getting Host Record by reference
GET https://grid:443/wapi/v2.9/record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5zdHRndHMuY2xvdWQubWxjMS5wMDEuc2Ft:REDACTED/default
{
"_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS5zdHRndHMuY2xvdWQubWxjMS5wMDEuc2Ft:REDACTED/default",
"ipv4addrs": [
{
"_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQuY29tLnN0dGd0cy5jbG91ZC5tbGMxLnAwMS5zYW0uMTAuOTcuOC4xLg:10.97.8.1/REDACTED/default",
"configure_for_dhcp": false,
"host": "REDACTED",
"ipv4addr": "10.97.8.1"
}
],
"name": "REDACTED",
"view": "default"
}
A simple fix could be to fix this line
// RecordHostObject defines the HOST record object's fields
type RecordHostObject struct {
...
ConfigureForDNS bool `json:"configure_for_dns"`
...
}
to
ConfigureForDNS bool `json:"configure_for_dns,omitempty"`
See: golang/lint#396
It looks like the underlying go Infoblox API does not support exclusions in the 'find by range' query so the exclusion list is not passed to the next available IP query.
https://github.com/prudhvitella/terraform-provider-infoblox/blob/master/infoblox/resource_infoblox_ip.go#L108
However there is no documentation that describes or states that the Exclusion list is ignored if you use the "ip_range" attribute. For example the value 10.0.10.10 will still be assigned using the following resource block.
resource "infoblox_ip" "test" {
ip_range="10.0.10.10-10.0.10.14"
exclude = ["10.0.10.10"] #Ignored
}`
I am just using the infoblox_ip resource to pull the next available ip in a given block but am not using a reserve_a/host/aaaa resource to reserve it. (I am running a go script to reserve the ip using an Infoblox Fixed Address).
When I do a subsequent plan the reserve_ip block only refreshes it's state and does not grab a new one. Is there any way to force it to rerun even though the IP isn't reserved within Terraform
Hi all,
First off - thanks for developing this. Way better than writing a custom python script to do this.
I'm running in to an issue with the latest download version (https://github.com/prudhvitella/terraform-provider-infoblox/releases/tag/pre-release) where I can only use the "infoblox_record" resource type, as when I try to define infoblox_record_host, or etc, I get a "provider doesn't support resource" error.
Is this expected behavior?
Thanks!
Using both terraform 0.8.4 and 0.8.6 gives me:
Error configuring: 1 error(s) occurred:
- Unrecognized remote plugin message: 2|unix|/var/folders/9k/gqp_92xx5ml9__33gkmw7wrj69yys9/T/tf-plugin282817430
This usually means that the plugin is either invalid or simply
needs to be recompiled to support the latest protocol.`
Could you please assist with the below error ?
infoblox_ip.theIPAddress: Creating...
cidr: "" => "10.13.34.0/24"
ipaddress: "" => ""
Error applying plan:
1 error(s) occurred:
infoblox_ip.theIPAddress: 1 error(s) occurred:
infoblox_ip.theIPAddress: unexpected EOF
Tf then crashes
Hi there
Im trying to use your porvider to get the next free ip from a network but I keep getting the error:
[DEBUG] plugin.terraform-provider-infoblox: panic: runtime error: index out of range
In the crash.log I see the API URL the providers tries to access.
If i manually acces the url via curl I get a valid reponse with unsed ip's.
Any idea what might be wrong?
Cheers
yodarx
As providers in Terraform 0.10.x are now externally loaded plugins, each with their own development cadence and repo in Hashicorp's terraform-providers project, it may make sense to move this repo to the official Terraform provider project.
Pre-released binaries are not statically compiled:
bash-4.4$ ldd terraform-provider-infoblox
/lib64/ld-linux-x86-64.so.2 (0x7f2322dbf000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f2322dbf000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f2322dbf000)
If for the next release, you could adopt a dockerfile to build them statically, like I did for another terraform plugin:
https://github.com/zoobab/terraform-provider-ldap/commits/Dockerfile
I will make a PR with those tools...
Broken on Terraform V10
Terraform v0.10.0
Incompatible API version with plugin. Plugin version: 2, Ours: 4
When using the infoblox_record_host
resource with a comment, the plan will always show the comment is being set from empty strings to whatever your comment is:
I changed some values:
~ infoblox_record_host.foo
comment: "" => "Some foo comment"
~ infoblox_record_host.bar
comment: "" => "Some bar comment"
When looking in the statefile, it's clear that the comment is not saved, even though it's saved in the actual infoblox record:
$ terragrunt state show infoblox_record_host.foo
id = record:host/ZG5zLmhvc3QkLjEuY29tLmVub3ZhLmZvby1tcGVzY2V0dG8tdGVzdC1mNTAx:foo-mpescetto-test-f501.enova.com/inside
comment =
configure_for_dns = false
ipv4addr.# = 4
ipv4addr.0.address = 10.1.1.22
ipv4addr.0.configure_for_dhcp = false
ipv4addr.0.mac =
ipv4addr.1.address = 10.1.2.22
ipv4addr.1.configure_for_dhcp = false
ipv4addr.1.mac =
ipv4addr.2.address = 10.1.2.23
ipv4addr.2.configure_for_dhcp = false
ipv4addr.2.mac =
ipv4addr.3.address = 10.7.1.23
ipv4addr.3.configure_for_dhcp = false
ipv4addr.3.mac =
ipv6addr.# = 0
name = foo.test.com
ttl = 0
view = inside
I got the following error recently, after some A
records were deleted from infoblox, but still existed in terraform state file:
Error refreshing state: 1 error(s) occurred:
* module.spark-master.infoblox_record.spark-master-dns: 1 error(s) occurred:
* module.spark-master.infoblox_record.spark-master-dns: infoblox_record.spark-master-dns: Couldn't find Infoblox A record: Error AdmConDataNotFoundError: Reference record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQudWsuYWMuc2FuZ2VyLmhnaSxzcGFyay0wMS1tYXN0ZXIsMTcyLjI3LjkxLjI1MQ:spark-01-master.hgi.sanger.ac.uk/internal not found - Client.Ibap.Data.NotFound - Reference record:a/ZG5zLmJpbmRfYSQuX2RlZmF1bHQudWsuYWMuc2FuZ2VyLmhnaSxzcGFyay0wMS1tYXN0ZXIsMTcyLjI3LjkxLjI1MQ:spark-01-master.hgi.sanger.ac.uk/internal not found
The problem here is that the terraform plugin Read
method returns an error when the resource does not exist (in this case from the line:
This is not what the Read
method is supposed to do according to the docs, which state: "If the ID is updated to blank, this tells Terraform the resource no longer exists (maybe it was destroyed out of band). Just like the destroy callback, the Read function should gracefully handle this case." (from https://www.terraform.io/guides/writing-custom-terraform-providers.html#implementing-read).
These error handlers should identify the condition when the error actually means "record not found" and in that case call d.SetId("")
and return nil
rather than returning an error.
according to https://www.terraform.io/upgrade-guides/0-12.html#upgrading-terraform-providers, .11 providers need to upgraded to work with TF .12
Anyone knows whether this module work in terraform 0.13 or not?
When I setup a new A record, the provider wants to set the comment and TTL again on the next apply. A second apply does not set the values.
My workaround for now is to not set TTL or comment. The comment is off less concern.
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
Is there anyway we can download provider using provider_url instead of manually downloading and copying to plugin directory.
provider "infoblox" {
provider_url = "https://github.com/prudhvitella/terraform-provider-infoblox/releases/download/pre-release/darwin_386_terraform-provider-infoblox"
}
When I try to create a record in Infoblox using terraform, it shows error : Invalid reference: record:a/wapi/v1.4.1/record:a
The version of Infoblox wapi that we use is v2.1. But the version supported is wapi/v1.4.1.
When I tried to access the link https://10.26.77.230/wapi/v2.1/record:a via browser, it worked. The result came in the form of XML.
Is it possible to convert version from 2.1 to 1.4.1?
I seem to be getting a panic when I try to create an A record.
InfoBlox Appliance version: 7.3.4
terraform --version
Terraform v0.6.16
terraform-provider-infoblox pre-release tag
Here are some lines of logs that show when it panics:
2016/07/11 10:49:46 [DEBUG] terraform-provider-infoblox: 2016/07/11 10:49:46 POST /wapi/v1.4.1/record:a payload: <PAYLOAD_REMOVED>
2016/07/11 10:49:46 [DEBUG] terraform-provider-infoblox: panic: runtime error: invalid memory address or nil pointer dereference
2016/07/11 10:49:46 [DEBUG] terraform-provider-infoblox: [signal 0xb code=0x1 addr=0x10 pc=0x532c12]
Infoblox provider is working fine with Terraform 0.11.X versions. When I tried with terraform 0.12.X, I am facing Incompatible API version with plugin issue
Error: Failed to instantiate provider "infoblox" to obtain schema: Incompatible API version with plugin. Plugin version: 4, Client versions: [5]
Sometimes you want to reserve next available IP without a host record.
Currently, the view
attribute seems only be supported for the A records (reading through the code; the readme is silent on that).
Please add the support of this attribute to the CNAME records as well.
I'd like to add reverse DNS addresses for my A records.
The provider does not allow PTR records, nor does it allow HOST records which appears to be an infoblox-specific thing that will create the A record AND the PTR for reverse lookups.
Hi, we are getting occasional 'panic: interface conversion: error is *errors.errorString, not infoblox.Error' which come from the type assertion err.(infoblox.Error).Code() in the handleReadError function in resource_infoblox_record.go
It seems to be trying to assert that an ordinary go error (from fmt.Errorf in this case) is an infoblox.Error
It would be possible to check for this using the type assertion test (t, ok := i.(T)) which should stop the panic. But would that be just covering up a problem elsewhere?
thanks, Sarah
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.