feat: remove unused firewall properties from settings usg

This commit is contained in:
Mateusz Filipowicz
2025-02-06 23:50:33 +01:00
committed by Mateusz Filipowicz
parent b19314bc6e
commit 4c3d5830ad
5 changed files with 14 additions and 36 deletions

2
.gitignore vendored
View File

@@ -3,3 +3,5 @@
.vscode
dist
terraform-provider-unifi
vendor/

View File

@@ -12,4 +12,4 @@ build:
.PHONY: testacc
testacc:
TF_LOG=debug TF_ACC=1 go test $(TEST) -test.parallel 2 -v -count $(TEST_COUNT) -timeout $(TEST_TIMEOUT) $(TESTARGS)
TF_LOG_PROVIDER=debug TF_ACC=1 go test $(TEST) -test.parallel 2 -v -count $(TEST_COUNT) -timeout $(TEST_TIMEOUT) $(TESTARGS)

View File

@@ -188,13 +188,14 @@ func TestAccDevice_empty(t *testing.T) {
}
func TestAccDevice_switch_basic(t *testing.T) {
//t.Skip("FIXME")
resourceName := "unifi_device.test"
site := "default"
device, unallocateDevice := allocateDevice(t)
defer unallocateDevice()
importStateVerifyIgnore := []string{"allow_adoption", "forget_on_destroy"}
importStateVerifyIgnore := []string{"allow_adoption", "forget_on_destroy", "name"}
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {

View File

@@ -259,12 +259,12 @@ func resourceNetwork() *schema.Resource {
Optional: true,
Default: true,
},
//"intra_network_access_enabled": {
// Description: "Specifies whether this network should be allowed to access other local networks or not.",
// Type: schema.TypeBool,
// Optional: true,
// Default: true,
//},
"network_isolation_enabled": {
Description: "Specifies whether this network should be isolated from other networks or not.",
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"ipv6_ra_preferred_lifetime": {
Description: "Lifetime in which the address can be used. Address becomes deprecated afterwards. Must be lower than or equal to `ipv6_ra_valid_lifetime`",
Type: schema.TypeInt,
@@ -472,7 +472,7 @@ func resourceNetworkGetResourceData(d *schema.ResourceData, meta interface{}) (*
IPV6RaValidLifetime: d.Get("ipv6_ra_valid_lifetime").(int),
InternetAccessEnabled: d.Get("internet_access_enabled").(bool),
//IntraNetworkAccessEnabled: d.Get("intra_network_access_enabled").(bool),
NetworkIsolationEnabled: d.Get("network_isolation_enabled").(bool),
WANIP: d.Get("wan_ip").(string),
WANType: d.Get("wan_type").(string),
@@ -592,7 +592,7 @@ func resourceNetworkSetResourceData(resp *unifi.Network, d *schema.ResourceData,
d.Set("enabled", resp.Enabled)
d.Set("igmp_snooping", resp.IGMPSnooping)
d.Set("internet_access_enabled", resp.InternetAccessEnabled)
//d.Set("intra_network_access_enabled", resp.IntraNetworkAccessEnabled)
d.Set("network_isolation_enabled", resp.NetworkIsolationEnabled)
d.Set("ipv6_interface_type", resp.IPV6InterfaceType)
d.Set("ipv6_pd_interface", resp.IPV6PDInterface)
d.Set("ipv6_pd_prefixid", resp.IPV6PDPrefixid)

View File

@@ -52,24 +52,6 @@ func resourceSettingUsg() *schema.Resource {
Optional: true,
Computed: true,
},
"firewall_guest_default_log": {
Description: "Whether the guest firewall log is enabled.",
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"firewall_lan_default_log": {
Description: "Whether the LAN firewall log is enabled.",
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"firewall_wan_default_log": {
Description: "Whether the WAN firewall log is enabled.",
Type: schema.TypeBool,
Optional: true,
Computed: true,
},
"dhcp_relay_servers": {
Description: "The DHCP relay servers.",
Type: schema.TypeList,
@@ -101,10 +83,6 @@ func resourceSettingUsgUpdateResourceData(d *schema.ResourceData, meta interface
setting.MdnsEnabled = mdns.(bool)
}
setting.FirewallGuestDefaultLog = d.Get("firewall_guest_default_log").(bool)
setting.FirewallLanDefaultLog = d.Get("firewall_lan_default_log").(bool)
setting.FirewallWANDefaultLog = d.Get("firewall_wan_default_log").(bool)
dhcpRelay, err := listToStringSlice(d.Get("dhcp_relay_servers").([]interface{}))
if err != nil {
return fmt.Errorf("unable to convert dhcp_relay_servers to string slice: %w", err)
@@ -148,9 +126,6 @@ func resourceSettingUsgUpsert(ctx context.Context, d *schema.ResourceData, meta
func resourceSettingUsgSetResourceData(resp *unifi.SettingUsg, d *schema.ResourceData, meta interface{}, site string) diag.Diagnostics {
d.Set("site", site)
d.Set("multicast_dns_enabled", resp.MdnsEnabled)
d.Set("firewall_guest_default_log", resp.FirewallGuestDefaultLog)
d.Set("firewall_lan_default_log", resp.FirewallLanDefaultLog)
d.Set("firewall_wan_default_log", resp.FirewallWANDefaultLog)
dhcpRelay := []string{}
for _, s := range []string{