From 2eba55a7f3104e7fbaa6ede39944ed7d9b244104 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 28 Feb 2023 22:19:22 +1100 Subject: [PATCH] Change default value for `allow_adoption` (#317) * Change default value for `allow_adoption` * Update docs --- docs/resources/device.md | 2 +- docs/resources/port_forward.md | 2 +- internal/provider/resource_device.go | 2 +- internal/provider/resource_device_test.go | 9 --------- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/docs/resources/device.md b/docs/resources/device.md index a817a5c..b834dca 100644 --- a/docs/resources/device.md +++ b/docs/resources/device.md @@ -59,7 +59,7 @@ resource "unifi_device" "us_24_poe" { ### Optional -- `allow_adoption` (Boolean) Specifies whether this resource should tell the controller to adopt the device on create. Defaults to `false`. +- `allow_adoption` (Boolean) Specifies whether this resource should tell the controller to adopt the device on create. Defaults to `true`. - `forget_on_destroy` (Boolean) Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to `true`. - `mac` (String) The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption). - `name` (String) The name of the device. diff --git a/docs/resources/port_forward.md b/docs/resources/port_forward.md index 298d85a..2ea39ad 100644 --- a/docs/resources/port_forward.md +++ b/docs/resources/port_forward.md @@ -18,7 +18,7 @@ description: |- ### Optional - `dst_port` (String) The destination port for the forwarding. -- `enabled` (Boolean, Deprecated) Specifies whether the port forwarding rule is enabled or not. This will attribute will be removed in a future release. Instead of disabling a port forwarding rule you can remove it from your configuration. +- `enabled` (Boolean, Deprecated) Specifies whether the port forwarding rule is enabled or not. Defaults to `true`. This will attribute will be removed in a future release. Instead of disabling a port forwarding rule you can remove it from your configuration. - `fwd_ip` (String) The IPv4 address to forward traffic to. - `fwd_port` (String) The port to forward traffic to. - `log` (Boolean) Specifies whether to log forwarded traffic or not. Defaults to `false`. diff --git a/internal/provider/resource_device.go b/internal/provider/resource_device.go index d625bcf..fc2a0d8 100644 --- a/internal/provider/resource_device.go +++ b/internal/provider/resource_device.go @@ -92,7 +92,7 @@ func resourceDevice() *schema.Resource { Description: "Specifies whether this resource should tell the controller to adopt the device on create.", Type: schema.TypeBool, Optional: true, - Default: false, + Default: true, }, "forget_on_destroy": { Description: "Specifies whether this resource should tell the controller to forget the device on destroy.", diff --git a/internal/provider/resource_device_test.go b/internal/provider/resource_device_test.go index 2a63acf..38ca42b 100644 --- a/internal/provider/resource_device_test.go +++ b/internal/provider/resource_device_test.go @@ -208,9 +208,6 @@ func testAccDeviceConfig(mac string) string { return fmt.Sprintf(` resource "unifi_device" "test" { mac = %q - - allow_adoption = true - forget_on_destroy = true } `, mac) } @@ -220,9 +217,6 @@ func testAccDeviceConfig_withName(mac, name string) string { resource "unifi_device" "test" { mac = %q name = %q - - allow_adoption = true - forget_on_destroy = true } `, mac, name) } @@ -241,9 +235,6 @@ resource "unifi_device" "test" { number = 2 name = "Port 2" } - - allow_adoption = true - forget_on_destroy = true } `, mac) }