terraform-provider-unifi: UDMP - Running the default wlan example fails

I’m getting failures with the following code, mostly taken from the samples:

terraform {
  required_providers {
    unifi = {
      source = "paultyng/unifi"
      version = "0.13.1-beta.1"
    }
  }
}

provider "unifi" {
  username = "xxxxxx"
  password = "xxxxxx"
  api_url  = "https://192.168.86.1"
  allow_insecure = true
}

data "unifi_wlan_group" "default" {
}

data "unifi_user_group" "default" {
}

resource "unifi_wlan" "wifi" {
  name          = "myssid"
  vlan_id       = 10
  passphrase    = "12345678"
  wlan_group_id = data.unifi_wlan_group.default.id
  user_group_id = data.unifi_user_group.default.id
  security      = "wpapsk"
}

Here is the output of version + apply:

terraform % terraform version
Terraform v0.13.2
+ provider registry.terraform.io/paultyng/unifi v0.13.1-beta.1

terraform % terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.unifi_user_group.default: Refreshing state...
data.unifi_wlan_group.default: Refreshing state...

Error: unable to decode body: GET s/default/rest/wlangroup invalid character '<' looking for beginning of value

Error: unable to decode body: GET s/default/rest/usergroup invalid character '<' looking for beginning of value

FYI I’m running controller version 5.14.24 and Dream Machine Pro firmware 1.8.1-rc.3.

Thanks for writing this!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@paultyng This seems to be working well for me now. Thanks for creating it, so much better to manage via code than poking around via the GUI.

@chrishas35 Thanks for sorting the CSRF piece.

I was able to add the CSRF pieces from that commit, into my fork and then get the apply to work properly with a custom built version of the provider, thanks @chrishas35.

@paultyng would you like me to do a PR with the changes? I don’t have any way to test it doesn’t break the other controller versions, just that it seems to work on the UDMP.