prudhvitella / terraform-provider-infoblox

Infoblox plugin for Terraform
Mozilla Public License 2.0
41 stars 54 forks source link

Adding a 'Host' record not an idempotent operation #37

Closed vkantsev closed 5 years ago

vkantsev commented 6 years ago

Hello,

I'm using:

The issue I'm observing:

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

Expected behavior

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.

JackBracken commented 6 years ago

Thanks for opening this issue @veselinkantsev

That's obviously a big problem. I'm currently travelling, but should be able to take a look over the weekend and test on Monday.

JackBracken commented 5 years ago

Should be fixed in the latest release. If you still have problems feel free to reopen.

vkantsev commented 5 years ago

Should be fixed in the latest release. If you still have problems feel free to reopen.

Much appreciated @JackBracken. Thank you for your quick response.