joneshf / terraform-provider-openwrt

A Terraform provider for OpenWrt using LuCI's JSON-RPC API
https://registry.terraform.io/providers/joneshf/openwrt
Mozilla Public License 2.0
33 stars 8 forks source link

Fix `peerdns` attribute #110

Closed joneshf closed 1 year ago

joneshf commented 1 year ago

The way we setup peerdns isn't correct. We don't want to require both that the proto be "dhcp" and "dhcpv6". That doesn't even make sense. And the fact that we can say that makes even less sense.

In order to show the failure, we add a failing test. We then implement a fix by adding a validator that disjoins multiple other validators. The test is effectively what we want in reality, so it passing here should give good confidence that we can do what we want.

It's unfortunate that we have to write this validator. Hopefully, it's an oversight and not intentional. We don't want to maintain this indefinitely. See https://github.com/hashicorp/terraform-plugin-framework-validators/issues/122 for the upstream issue.