paultyng/terraform-provider-unifi

Error: error api.err.ApGroupMissing (400 ) for POST https://100.101.66.56:8443/api/s/default/rest/wlanconf

Closed this issue · 4 comments

So the docs say ap_group_ids is optional, but in trying to configure a new controller (before any AP's have been connected)

(I'm using https://hub.docker.com/r/jacobalberty/unifi )

provider "unifi" {
  username = data.lastpass_secret.folly_wifi.username # optionally use UNIFI_USERNAME env var
  password = data.lastpass_secret.folly_wifi.password # optionally use UNIFI_PASSWORD env var
  api_url  = "https://${var.ip_address}:8443"  # optionally use UNIFI_API env var

  allow_insecure = true
}

data "unifi_user_group" "default" {
}

resource "unifi_wlan" "wifi" {
  name          = data.lastpass_secret.folly_wifi.username
  //vlan_id       = 10
  passphrase    = data.lastpass_secret.folly_wifi.password
  user_group_id = data.unifi_user_group.default.id
  security      = "wpapsk"
  ap_group_ids = []
}

While I'd like terraform to init the controller from nothing, I did go through the wizard it has to add a local admin, etc

I believe ap_group_ids is only optional because its not required for v5, only required in v6. Unfortunately the validation available in the Terraform Provider SDK doesn't let me make this very clear. Once I drop support for v5, should make it a bit more straightforward.

This PR has an example for v6, I need to merge it in to update the docs: #75

roger, merci!

I think that solves your issue, going to close this, but feel free to let me know if it didn't.