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

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

Open
grimm26 opened this issue Dec 27, 2023 · 0 comments

Comments

@grimm26
Copy link

grimm26 commented Dec 27, 2023

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant