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

import and configuration mismatch #371

Open
chupacabra71 opened this issue May 22, 2023 · 2 comments
Open

import and configuration mismatch #371

chupacabra71 opened this issue May 22, 2023 · 2 comments

Comments

@chupacabra71
Copy link

Not sure if i am doing something wrong or if it is the plugin, but i am having a problem reconciling imported data with the config i am building. i imported some access points and a switch, and all that imported fine. When i do a terraform plan, it always shows that the resources need changes even though the configuration matches the import.

Here is the configuration:

#10GB Aggregation Switch
resource "unifi_device" "USW-Aggregation" {
  mac = "ac:8b:a9:b4:fb:de"
  name = "USW-Aggregation"

  port_override {
      name                = "PVE03"
      number              = 3
      op_mode             = "switch"
  }
  port_override {
      name                = "PVE01"
      number              = 1
      op_mode             = "switch"
  }
  port_override {
      name                = "PVE02"
      number              = 2
      op_mode             = "switch"
  }
  port_override {
      name                = "SFP+ 4"
      number              = 4
      port_profile_id     = "645513558013ec568e5cb0b3"
  }
  port_override {
      name                = "SFP+ 6"
      number              = 6
      op_mode             = "switch"
  }
  port_override {
      name                = "TRUNK - UNIFI"
      number              = 8
      op_mode             = "switch"
  }
  port_override {
      name                = "TRUNK - USW-24-Core"
      number              = 7
      op_mode             = "switch"
  }
  port_override {
      aggregate_num_ports = 2
      name                = "TRUNK - SILO-NAS01"
      number              = 5
      op_mode             = "aggregate"
  }
}

resource "unifi_device" "AP-Downstairs" {
  mac = "74:83:c2:d3:57:57"
  name = "AP Downstairs"
}	
	
resource "unifi_device" "AP-Upstairs" {
  mac                   = "74:83:c2:d3:42:c9"
  name                  = "AP Upstairs"
}	

resource "unifi_device" "AP-Office" {
  mac = "ac:8b:a9:42:e8:6d"
  name = "AP Office"
}	

Here is the plan output:

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:

  # unifi_device.AP-Downstairs will be updated in-place
  ~ resource "unifi_device" "AP-Downstairs" {
      + allow_adoption    = true
      + forget_on_destroy = true
        id                = "62321826f9240f062eb5dd77"
        name              = "AP Downstairs"
        # (3 unchanged attributes hidden)
    }

  # unifi_device.AP-Office will be updated in-place
  ~ resource "unifi_device" "AP-Office" {
      + allow_adoption    = true
      + forget_on_destroy = true
        id                = "640b36885e789b141ae031c4"
        name              = "AP Office"
        # (3 unchanged attributes hidden)
    }

  # unifi_device.AP-Upstairs will be updated in-place
  ~ resource "unifi_device" "AP-Upstairs" {
      + allow_adoption    = true
      + forget_on_destroy = true
        id                = "62321f1df9240f062eb5e295"
        name              = "AP Upstairs"
        # (3 unchanged attributes hidden)
    }

  # unifi_device.USW-Aggregation will be updated in-place
  ~ resource "unifi_device" "USW-Aggregation" {
      + allow_adoption    = true
      + forget_on_destroy = true
        id                = "645035fc8be3227a24375e25"
        name              = "USW-Aggregation"
        # (3 unchanged attributes hidden)

      - port_override {
          - aggregate_num_ports = 0 -> null
          - name                = "PVE01" -> null
          - number              = 1 -> null
          - op_mode             = "switch" -> null
        }
      - port_override {
          - aggregate_num_ports = 0 -> null
          - name                = "PVE02" -> null
          - number              = 2 -> null
          - op_mode             = "switch" -> null
        }
      - port_override {
          - aggregate_num_ports = 0 -> null
          - name                = "PVE03" -> null
          - number              = 3 -> null
          - op_mode             = "switch" -> null
        }
      - port_override {
          - aggregate_num_ports = 0 -> null
          - name                = "SFP+ 4" -> null
          - number              = 4 -> null
          - port_profile_id     = "645513558013ec568e5cb0b3" -> null
        }
      - port_override {
          - aggregate_num_ports = 0 -> null
          - name                = "SFP+ 6" -> null
          - number              = 6 -> null
          - op_mode             = "switch" -> null
        }
      - port_override {
          - aggregate_num_ports = 0 -> null
          - name                = "TRUNK - UNIFI" -> null
          - number              = 8 -> null
          - op_mode             = "switch" -> null
        }
      - port_override {
          - aggregate_num_ports = 0 -> null
          - name                = "TRUNK - USW-24-Core" -> null
          - number              = 7 -> null
          - op_mode             = "switch" -> null
        }
      - port_override {
          - aggregate_num_ports = 2 -> null
          - name                = "TRUNK - SILO-NAS01" -> null
          - number              = 5 -> null
          - op_mode             = "aggregate" -> null
        }
      + port_override {
          + aggregate_num_ports = 2
          + name                = "TRUNK - SILO-NAS01"
          + number              = 5
          + op_mode             = "aggregate"
        }
      + port_override {
          + name    = "PVE01"
          + number  = 1
          + op_mode = "switch"
        }
      + port_override {
          + name    = "PVE02"
          + number  = 2
          + op_mode = "switch"
        }
      + port_override {
          + name    = "PVE03"
          + number  = 3
          + op_mode = "switch"
        }
      + port_override {
          + name            = "SFP+ 4"
          + number          = 4
          + port_profile_id = "645513558013ec568e5cb0b3"
        }
      + port_override {
          + name    = "SFP+ 6"
          + number  = 6
          + op_mode = "switch"
        }
      + port_override {
          + name    = "TRUNK - UNIFI"
          + number  = 8
          + op_mode = "switch"
        }
      + port_override {
          + name    = "TRUNK - USW-24-Core"
          + number  = 7
          + op_mode = "switch"
        }
    }
@joshuaspence
Copy link
Collaborator

The allow_adoption and force_destroy changes are fine as those are meta properties that don't affect actual UniFi resources.

The changes to the switch seem like a bug, I'll have to investigate further.

@chupacabra71
Copy link
Author

The allow_adoption and force_destroy changes are fine as those are meta properties that don't affect actual UniFi resources.

The changes to the switch seem like a bug, I'll have to investigate further.

Thanks, anything i can provide to help out?

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

2 participants