Skip to content

netbox_available_ip_address import does not set prefix_id causing a "must be replaced" #861

@maikelpoot

Description

@maikelpoot

When importing an existent ip_address the state isn't filled with the current prefix_id causing the resource to be replaced in netbox.
The replace could result a different ip address causing problems or downtime.

Expected Behavior

Expected that the ip address is imported as-is and won't change on next run

Actual Behavior

The missing prefix_id forces a replacement of the resource, and triggering updates on other resources.

How to reproduce:

Resource:

resource "netbox_available_ip_address" "lb" {
  prefix_id   = 62
  description = "test2"
}

Commands:

% tofu import 'netbox_available_ip_address.lb' 1871 
...
netbox_available_ip_address.lb: Import prepared!
  Prepared netbox_available_ip_address for import
netbox_available_ip_address.lb: Refreshing state... [id=1871]
Import successful!
...

% tofu plan 
... 
# netbox_available_ip_address.lb must be replaced
-/+ resource "netbox_available_ip_address" "lb" {
      ~ description = "test" -> "test2"
      ~ id          = "1871" -> (known after apply)
      ~ ip_address  = "X.X.X.X/32" -> (known after apply)
      + prefix_id   = 62 # forces replacement
      - tags        = [] -> null
      ~ tags_all    = [] -> (known after apply)
      - tenant_id   = 0 -> null
      - vrf_id      = 0 -> null
        # (1 unchanged attribute hidden)
    }
...

Environment

  • Provider version: 5.2.1
  • Netbox version: NetBox Community v4.4.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions