paultyng / terraform-provider-unifi

Terraform provider for Unifi :satellite:
https://registry.terraform.io/providers/paultyng/unifi/latest/docs
Mozilla Public License 2.0
515 stars 91 forks source link

UNMS support? #87

Open OJFord opened 3 years ago

OJFord commented 3 years ago

Sorry for the question - I don't have any Ubiquiti gear (yet?) but I'm considering it and trying to understand UNMS vs. Unifi Controller. Would this provider at least in theory work with UNMS too, or with slight modification?

I'd be more than happy to contribute, just not keen to start from scratch with a different provider if it's completely different under the hood. (Since then I may as well go back to looking at Mikrotik, (or even my existing OpenWRT) as was my plan before being enticed by your work here :+1:.)

Edit: Sorry, I realise too late this is more of a question for go-unifi, I'd move it if I could but it seems you need to be owner/collab on the repo in order to, odd as that is.

paultyng commented 3 years ago

No worries, the SDK was written almost entirely for this to begin with anyway. I'm honestly not sure, I haven't used UNMS specifically before, so not entirely clear what the differences are and I'd need to look in to it.

In terms of this provider vs another provider, the distinction we typically use is does it use the same auth / configuration, if so, then it could be the same provider, but if not, if its two separate authentications, then it should probably just be different providers (kind of have this documented here). The reasoning being if you are only using one half of resources or the other, it makes the authentication / configuration kind of annoying, you may need to make a bunch of things optional and do complex validation, etc.

kurtmc commented 3 years ago

We are using both Unifi and UNMS (Ubiquiti are renaming it to UISP), the basic difference between the two is that Unifi Network Controller is used to manage Ubiquiti Unifi devices and UISP is used to manage their Edge/airMax/airFibre devices.

I think that it should be a separate provider.

I've been thinking about creating that terraform provider, but I think the first thing that I should do is figure out if it's possible to do the same trick you do here @paultyng : https://github.com/paultyng/go-unifi/tree/main/fields

kurtmc commented 3 years ago

There's actually no need for that hack, UISP serves up a swagger spec. So probably just need to write a simple script to pull it from the docker image.

I've uploaded the swagger spec from my running instance if anyone is interested in having a look at it: https://gist.github.com/kurtmc/1f28dc5ebd757b018774da4ac4a93bd4

Edit: :smile: docker run --rm --entrypoint /bin/bash -it ubnt/unms:1.3.7 -c "cat lib/api-docs/public/swagger_v2.yaml"

paultyng commented 3 years ago

Ah yeah, that would make this so much easier if it existed on Unifi. If you spin up that provider / SDK, happy to add some cross linking in here for folks to find it but I agree it probably should be a separate provider.

paultyng commented 3 years ago

Honestly, I haven't gone looking through the Unifi install in a while, its possible they've added it there or something also recently, like in v6, unsure.