paultyng/terraform-provider-unifi

Error: api.err.Invalid (400 Bad Request) for PUT https://192.168.86.1/proxy/network/api/s/default/rest/device/5ddfb6fa7fa2bb02a577154a

ukd1 opened this issue · 2 comments

ukd1 commented

When applying terraform, I get the following error, running controller 6.2.23 and your provider v 0.26.0

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # unifi_device.closest_udm_pro will be updated in-place
  ~ resource "unifi_device" "closest_udm_pro" {
        id       = "5ddfb6fa7fa2bb02a577154a"
      ~ name     = "UniFi UDM Pro" -> "Closet UDM Pro"
        # (3 unchanged attributes hidden)

        # (3 unchanged blocks 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

unifi_device.closest_udm_pro: Modifying... [id=5ddfb6fa7fa2bb02a577154a]

Error: api.err.Invalid (400 Bad Request) for PUT https://192.168.86.1/proxy/network/api/s/default/rest/device/5ddfb6fa7fa2bb02a577154a

  on unifi.tf line 42, in resource "unifi_device" "closest_udm_pro":
  42: resource "unifi_device" "closest_udm_pro" {


russ@Russells-MBP infra %

L42 is the first line listed below:

resource "unifi_device" "closest_udm_pro" {
  mac  = "e0:63:xx:xx:xx:xx"
  name = "Closet UDM Pro"
  port_override {
    number          = 4
    port_profile_id = "5e3895fccde92e021fe5d635"
  }
  port_override {
    number          = 7
    port_profile_id = "5e3895fccde92e021fe5d635"
  }
  port_override {
    number          = 8
    port_profile_id = "5e3895fccde92e021fe5d635"
  }
}

I think you may be able to see the API request by turning on the Terraform's trace logging.

The best thing to do here is see what is the difference between what is done via Terraform and what is done in the UI for the API request. Unfortunately when a bad API request is sent, not a lot of additional information is specified.

Unsure if this still a problem for you. I'm able to modify ports on my UDM pro without error currently so going to close. If you are still experiencing this please let me know!