-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
The future path for the Unifi provider #461
Comments
Thanks for the write up. I have been meaning to get better at maintaining this project but have young kids at home, which has made it difficult. I am happy to bring in additional maintainers to the project. With some additional maintainers I thought no it would help to renew my interest in the project The last time I worked on this project I was trying to think about how to handle a change in the underlying API in which Unifi removed / significantly changed functionality in a minor version and I wasn't sure how to deal with that. I can't remember if that is still an issue |
Only registered provider other than this one is https://registry.terraform.io/providers/akerl/unifi/latest |
I'm not not maintaining it 😄 When I forked, my original goal was to apply my patch for #389 , so that I could have a public statefile w/o leaking passphrases. From there, I've been pulling in updates and patches (some of mine, some from other folks opening PRs on this repo) to keep it working as Unifi changes their services. I maybe run the provider once every couple of months, when I add some new DHCP reservations to my network or decom some old services, so I'm not actively using it on a daily basis, but I do have interest in keeping it working. |
Hi everyone, Thank you @evenh for sharing Paul's message and opening the discussion. I've forked the original terraform-provider-unifi and created an updated version: This fork supports UniFi Controller v8.4.59. Currently, the following resources are fully tested and confirmed working:
I'm actively working to expand the feature set and improve stability. For more information, please refer to the README and the Terraform documentation. I should note that this provider is under active development and should be considered experimental at this stage. While some features are thoroughly tested, others are still a work in progress. Testing and feedback are highly appreciated. I’d also like to acknowledge the efforts of those who have been working on forks of this provider, such as @appkins, @akerl and others. It would be fantastic if we could coordinate our efforts to create a unified, actively maintained version. I've also forked and updated the go-unifi SDK to support UniFi Controller v8.4.59. If Paul agrees, it would be great if the original repository could point to this fork as the actively maintained version for those looking for continued development and compatibility with newer UniFi versions. Thanks again for sharing this and for everyone's interest in keeping this project moving forward. I'm looking forward to any contributions, feedback, or discussions from the community. Best, |
Thanks @sayedh for your input. I am a co-maintainer of this project although haven't been able to spend any time of it lately for personal reasons. Having said that, I am experiencing a renewed interest for this project and would like to continue development. I would rather continue working on this project than point to a fork but, of course, this is open source and the community can choose to use this repository or any of the forks. I will work to close off the open PRs this week |
I noticed my PR is mentioned here. I'm happy to help with any clean up needed to get the changes merged in. As it happens I've been revisiting this stuff today because I need to automate some configuration on my USG. |
I am currently working through the PR backlog. One thing that would help us making sure your PRs have acceptance test coverage. There are a few flakey acceptance tests that I need to chase down but mostly the acceptance tests are in a good place. The acceptance tests work by spinning up a demo install of Unifi Network. The demo install has a bunch of demo devices that can be used for testing devices, everything else can be created/modified as needed within the tests. I'll try to close some of the PRs off without tests (or add the tests myself) but I'd like to maintain a high level of test coverage for this provider as there are a lot of edge cases in using an unofficial, undocumented API |
@joshuaspence - Thanks for taking this up again and working through the backlog. I'd like to pitch in somehow. I've been using terraform at work for a couple years, and just recently got some ubiquiti gear. I have programming background, but haven't learned go yet. I suspect there are several people here with similar skill sets. Is there something I can do to help out? |
@britthouser The main thing that needs to be done to make it easier to contribute to this repository is to fix the flakey acceptance tests, which I would definitely welcome contributions on. Once this is done it will be significantly easier to review PRs with confidence that we won't break existing functionality. Historically, running the acceptance tests was tricky as many of the UniFi features require physical hardware to configure. I fixed this in #150, #155, #185 and #188 by utilising an undocumented demo mode, which creates a bunch of fake UniFi devices which behave like real devices. So as of today we should be able to test most of the functionality provided by the provider. There may be some gaps because I don't think the demo mode creates all of the available device types, but I suspect 90-95% of functionality can and should have acceptance test coverage. Note that since this demo mode is undocumented it is possible that UniFi removes it in the future, which will complicate things significantly. Basically, in demo mode we have 20 fake UniFi devices (this is configurable). When an acceptance test needs to use a device it calls allocateDevice, which allocates a device from the devicePool. In the future we will likely want to be able to allocate different device types, currently we only do this for switches. There is some additional logic to ignore certain devices for various reasons (see #316 for one such examples). Test flakiness is sometimes caused when multiple tests attempt to use the same name for a resource. The easiest fix for this is to randomise the resource names, see #156 for one such examples. Another common failure I have seen but haven't had a chance to investigate is this:
To aid with debugging, the Docker containers will dump out the UniFi logs after test execution (see #335). In theory this should aid with debugging although in practice it generates a lot of noise. It might be reasonable to log to a file instead and/or tweaking log levels. There is also some logic for allocating MAC addresses and VLANs. This logic is not as robust as the device allocation code and will likely need work at some stage, but I don't think it is causing issues right now. Specifically the getTestVlan function doesn't have a way to unallocate VLANs so it can only be used ~4096 times. |
@joshuaspence Thanks too for picking the project up! I'd also like to help to get this provider up-to-date and in a status where every functionality is supported. |
Thanks, I agree that we should migrate to the new plugin framework. I think that the acceptance tests should be fixed first though to give a greater confidence in the migration. |
Another consideration here is whether we should continue supporting all of the Unifi versions that are currently supported. I think it's probably reasonable to drop support for 6.x and 7.x now |
Ah neat, I wasn't aware that was possible |
Hi @joshuaspence , great work so far! I hope to have one provider and to bring this repo to life. I tried to track down problems with acceptance tests you mentioned, and there seems to be few things at first glance:
To deal with #1 and #2, I'd recommend to either temporarily disable those or mark as allowed to fail until they are fixed. This would allow for bringing parity with other providers quickly, while solving test flakiness just after that. I can spend some time to move over changes from other providers mentioned here, to have parity with those. I would additionally work on deprecations as I mentioned. If you're fine I can drop few PRs in upcoming weeks with those. |
Yeah, agree.
These issues should be minor and shouldn't fail the tests. If you find any real issues then we can address those but I found some in #338 which seems to be because some fields can be read from the API but not written (e.g. device state). Should be easy to fix in
I'd like to maintain support for the latest major version. Possibly we should maintain support for the previous version as well, although only if it is easy to do so.
Yeah absolutely |
Hi all 👋🏻
I've tested this provider through the last few years and got it 80% working every time. As a irregular contributor to various open source projects myself I know that maintenance of and interest in these projects can vary when jobs, roles or life itself changes. With that in mind I reached out to @paultyng via email this summer and got a reply that drowned in my mailbox until I found it today (I'm really sorry). The reply was this:
I thought I'd share it with the community in case somebody wants to step up and maintain a fork. At least this is a starting point for a discussion. I found a few recent forks which may or may not be candidates going forward:
Related issues:
cc @joshuaspence
The text was updated successfully, but these errors were encountered: