infobloxopen/terraform-provider-infoblox

infoblox_ip_allocation with enable_dns = false and dns_view set will fail on second apply

Opened this issue ยท 0 comments

infoblox_ip_allocation will happily take a value for dns_view when enable_dns is set to false and even tell you that it is setting that parameter to what you supplied. However, it actually sets it to " " and then the next apply will fail.

One of two things needs to happen:

  1. Ignore the value of dns_view when enable_dns is set to false.
  2. Do not allow dns_view to be set when enable_dns is false.

The documentation currently supports option 2, but that is not enforced and instead for some strange reason the value for dns_view is transformed into a single whitespace.

mnk-hpbook in ~/tf/ib2 ๐Ÿ’  v1.5.7 ๓ฐธ (ohio) took 22s 
08:38:38 โฏ tf -version
Terraform v1.5.7
on linux_amd64
+ provider registry.terraform.io/infobloxopen/infoblox v2.5.0

mnk-hpbook in ~/tf/ib2 ๐Ÿ’  v1.5.7 ๓ฐธ (ohio) 
08:38:43 โฏ cat ib2.tf
resource "infoblox_ip_allocation" "ip" {
  enable_dns = false
  dns_view   = "inside"
  fqdn       = "mkthing.staging.thing.com"
  ipv4_cidr  = "10.18.81.0/24"
}

terraform {
  required_version = "~> 1.3"
  required_providers {
    infoblox = {
      source  = "infobloxopen/infoblox"
      version = "~> 2.1"
    }
  }
}

mnk-hpbook in ~/tf/ib2 ๐Ÿ’  v1.5.7 ๓ฐธ (ohio) 
08:38:53 โฏ tfa

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # infoblox_ip_allocation.ip will be created
  + resource "infoblox_ip_allocation" "ip" {
      + allocated_ipv4_addr = (known after apply)
      + allocated_ipv6_addr = (known after apply)
      + dns_view            = "inside"
      + enable_dns          = false
      + fqdn                = "mkthing.staging.thing.com"
      + id                  = (known after apply)
      + internal_id         = (known after apply)
      + ipv4_cidr           = "10.18.81.0/24"
      + network_view        = "default"
      + ref                 = (known after apply)
      + ttl                 = -2147483648
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

infoblox_ip_allocation.ip: Creating...
infoblox_ip_allocation.ip: Creation complete after 2s [id=976904b6-b632-47cf-b135-0e6e4a1b99e3]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

mnk-hpbook in ~/tf/ib2 ๐Ÿ’  v1.5.7 ๓ฐธ (ohio) took 3s 
08:38:59 โฏ tfa
infoblox_ip_allocation.ip: Refreshing state... [id=976904b6-b632-47cf-b135-0e6e4a1b99e3]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # infoblox_ip_allocation.ip will be updated in-place
  ~ resource "infoblox_ip_allocation" "ip" {
      ~ dns_view            = " " -> "inside"
        id                  = "976904b6-b632-47cf-b135-0e6e4a1b99e3"
        # (8 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

infoblox_ip_allocation.ip: Modifying... [id=976904b6-b632-47cf-b135-0e6e4a1b99e3]
โ•ท
โ”‚ Error: changing the value of 'dns_view' field is allowed only for the case of changing 'enable_dns' option
โ”‚ 
โ”‚   with infoblox_ip_allocation.ip,
โ”‚   on ib2.tf line 1, in resource "infoblox_ip_allocation" "ip":
โ”‚    1: resource "infoblox_ip_allocation" "ip" {
โ”‚ 
mnk-hpbook in ~/tf/ib2 ๐Ÿ’  v1.5.7 ๓ฐธ (ohio) 
08:40:18 โŒ1 โฏ tf state show infoblox_ip_allocation.ip
# infoblox_ip_allocation.ip:
resource "infoblox_ip_allocation" "ip" {
    allocated_ipv4_addr = "10.18.81.21"
    dns_view            = " "
    enable_dns          = false
    fqdn                = "mkthing.staging.thing.com"
    id                  = "976904b6-b632-47cf-b135-0e6e4a1b99e3"
    internal_id         = "976904b6-b632-47cf-b135-0e6e4a1b99e3"
    ipv4_cidr           = "10.18.81.0/24"
    network_view        = "default"
    ref                 = "record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjEuMTcwMzY4NzkzODU5NC5jb20udGhpbmcuc3RhZ2luZy5ta3RoaW5n:mkthing.staging.thing.com/%20"
    ttl                 = -2147483648
}