diff --git a/routeros/mikrotik_serialize.go b/routeros/mikrotik_serialize.go index c0cfb74b..8b347439 100644 --- a/routeros/mikrotik_serialize.go +++ b/routeros/mikrotik_serialize.go @@ -14,7 +14,7 @@ import ( ) var reMetadataFields = regexp.MustCompile(`^___\S+___$`) -var reTransformSet = regexp.MustCompile(`"\s*?(\S+?)\s*?"\s*?:\s*?"\s*?(\S+?)\s*?"`) +var reTransformSet = regexp.MustCompile(`"\s*?(\S+?)\s*?\s*?:\s*?\s*?(\S+?)\s*?"`) var reSkipFields = regexp.MustCompile(`"\s*?(\S+?)\s*?"\s*?`) // GetMetadata Get item metadata fields from resource schema. @@ -97,14 +97,6 @@ func loadSkipFields(s string) (m map[string]struct{}) { return } -func loadDropByValue(s string) (m map[string]struct{}) { - m = make(map[string]struct{}) - for _, value := range strings.Split(s, ",") { - m[value] = struct{}{} - } - return m -} - // ListToString Convert List and Set to a delimited string. func ListToString(v any) (res string) { for i, elem := range v.([]interface{}) { @@ -314,7 +306,7 @@ func MikrotikResourceDataToTerraform(item MikrotikItem, s map[string]*schema.Sch } if dbv, ok := s[MetaDropByValue]; ok { - dropByValue = loadDropByValue(dbv.Default.(string)) + dropByValue = loadSkipFields(dbv.Default.(string)) } // TypeMap,TypeSet initialization information storage. diff --git a/routeros/mikrotik_serialize_test.go b/routeros/mikrotik_serialize_test.go index 8b09de80..9f4945ae 100644 --- a/routeros/mikrotik_serialize_test.go +++ b/routeros/mikrotik_serialize_test.go @@ -130,10 +130,10 @@ func Test_loadTransformSet(t *testing.T) { s string reverse bool }{ - {`"channel":"channel.config","datapath":"datapath.config"`, false}, - {`"mikrotik-field-name":"schema-field-name"`, false}, - {`"channel":"channel.config","datapath":"datapath.config"`, true}, - {`"mikrotik-field-name":"schema-field-name"`, true}, + {toQuotedCommaSeparatedString("channel: channel.config","datapath: datapath.config"), false}, + {toQuotedCommaSeparatedString("mikrotik-field-name : schema-field-name"), false}, + {toQuotedCommaSeparatedString("channel: channel.config","datapath: datapath.config"), true}, + {toQuotedCommaSeparatedString("mikrotik-field-name:schema-field-name"), true}, } expected := []map[string]string{ @@ -149,3 +149,24 @@ func Test_loadTransformSet(t *testing.T) { } } } + +func Test_loadSkipFields(t *testing.T) { + testData := []struct { + s string + }{ + {toQuotedCommaSeparatedString("name")}, + {toQuotedCommaSeparatedString("name", "rx_1024_1518", "rx_128_255", "rx_1519_max", "rx_256_511", "rx_512_1023", "rx_64")}, + } + + expected := []map[string]struct{}{ + {"name": struct{}{}}, + {"name": struct{}{}, "rx_1024_1518": struct{}{}, "rx_128_255": struct{}{}, "rx_1519_max": struct{}{}, + "rx_256_511": struct{}{}, "rx_512_1023": struct{}{}, "rx_64": struct{}{}}, + } + + for i, actual := range testData { + if !reflect.DeepEqual(loadSkipFields(actual.s), expected[i]) { + t.Fatalf("bad: (item: %v) expected:%#v\tactual:%#v", i, expected[i], loadSkipFields(actual.s)) + } + } +} diff --git a/routeros/provider_schema_helpers.go b/routeros/provider_schema_helpers.go index 688abbff..bd1ec87c 100644 --- a/routeros/provider_schema_helpers.go +++ b/routeros/provider_schema_helpers.go @@ -80,11 +80,23 @@ func PropId(t IdType) *schema.Schema { } } -func PropDropByValue(values ...string) *schema.Schema { +func toQuotedCommaSeparatedString(s ...string) string { + builder := strings.Builder{} + const singleQuote = `"` + const commaSingleQuote = `,"` + builder.WriteString(singleQuote + s[0] + singleQuote) + + for i := 1; i < len(s); i++ { + builder.WriteString(commaSingleQuote + s[i] + singleQuote) + } + return builder.String() +} + +func PropDropByValue(s ...string) *schema.Schema { return &schema.Schema{ Type: schema.TypeString, Optional: true, - Default: strings.Join(values, ","), + Default: toQuotedCommaSeparatedString(s...), Description: "A list of values when generated by RouterOs will be dropped, useful to default values as 'unspecified' for null", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return true @@ -93,11 +105,11 @@ func PropDropByValue(values ...string) *schema.Schema { } // PropTransformSet -func PropTransformSet(s string) *schema.Schema { +func PropTransformSet(s ...string) *schema.Schema { return &schema.Schema{ Type: schema.TypeString, Optional: true, - Default: s, + Default: toQuotedCommaSeparatedString(s...), Description: "A set of transformations for field names. This is an internal service field, setting a value is not required.", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return true @@ -106,11 +118,11 @@ func PropTransformSet(s string) *schema.Schema { } // PropSkipFields -func PropSkipFields(s string) *schema.Schema { +func PropSkipFields(s ...string) *schema.Schema { return &schema.Schema{ Type: schema.TypeString, Optional: true, - Default: s, + Default: toQuotedCommaSeparatedString(s...), Description: "A set of transformations for field names. This is an internal service field, setting a value is not required.", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return true @@ -118,33 +130,12 @@ func PropSkipFields(s string) *schema.Schema { } } -// PropSkipFieldsSlice creates the metadata field of Mikrotik items to be ignored. This means -// that responses from the router with those fields will be silently ignored. -func PropSkipFieldsSlice(s ...string) *schema.Schema { - if len(s) == 0 { - panic(fmt.Errorf("provider error, can't creat skip properties without properties")) - } - return PropSkipFields(toQuotedCommaSeparatedString(s...)) -} - -func toQuotedCommaSeparatedString(s ...string) string { - builder := strings.Builder{} - const singleQuote = "\"" - const commaSingleQuote = ",\"" - builder.WriteString(singleQuote + s[0] + singleQuote) - - for i := 1; i < len(s); i++ { - builder.WriteString(commaSingleQuote + s[i] + singleQuote) - } - return builder.String() -} - // PropSetUnsetFields -func PropSetUnsetFields(s string) *schema.Schema { +func PropSetUnsetFields(s ...string) *schema.Schema { return &schema.Schema{ Type: schema.TypeString, Optional: true, - Default: s, + Default: toQuotedCommaSeparatedString(s...), Description: "A set of fields that require setting/unsetting. This is an internal service field, setting a value is not required.", DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return true diff --git a/routeros/resource_capsman_configuration.go b/routeros/resource_capsman_configuration.go index e27ccaf5..f92d24c3 100644 --- a/routeros/resource_capsman_configuration.go +++ b/routeros/resource_capsman_configuration.go @@ -39,8 +39,8 @@ func ResourceCapsManConfiguration() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/caps-man/configuration"), MetaId: PropId(Id), - MetaTransformSet: PropTransformSet(`"channel": "channel.config", "datapath": "datapath.config", - "rates": "rates.config", "security": "security.config"`), + MetaTransformSet: PropTransformSet("channel: channel.config", "datapath: datapath.config", + "rates: rates.config", "security: security.config"), "channel": { Type: schema.TypeMap, diff --git a/routeros/resource_capsman_configuration_v0.go b/routeros/resource_capsman_configuration_v0.go index 98b28ad3..294a0663 100644 --- a/routeros/resource_capsman_configuration_v0.go +++ b/routeros/resource_capsman_configuration_v0.go @@ -10,8 +10,8 @@ func ResourceCapsManConfigurationV0() *schema.Resource { Schema: map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/caps-man/configuration"), MetaId: PropId(Name), - MetaTransformSet: PropTransformSet(`"channel": "channel.config", "datapath": "datapath.config", - "rates": "rates.config", "security": "security.config"`), + MetaTransformSet: PropTransformSet("channel: channel.config", "datapath: datapath.config", + "rates: rates.config", "security: security.config"), "channel": { Type: schema.TypeMap, diff --git a/routeros/resource_interface_bridge_port.go b/routeros/resource_interface_bridge_port.go index 74089747..402c26ea 100644 --- a/routeros/resource_interface_bridge_port.go +++ b/routeros/resource_interface_bridge_port.go @@ -71,7 +71,7 @@ func ResourceInterfaceBridgePort() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/interface/bridge/port"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"debug_info","port_number"`), + MetaSkipFields: PropSkipFields("debug_info", "port_number"), "nextid": { Type: schema.TypeString, diff --git a/routeros/resource_interface_ethernet.go b/routeros/resource_interface_ethernet.go index c4446b6b..844af821 100644 --- a/routeros/resource_interface_ethernet.go +++ b/routeros/resource_interface_ethernet.go @@ -51,16 +51,15 @@ func ResourceInterfaceEthernet() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/interface/ethernet"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields( - `"factory_name","driver_rx_byte","driver_rx_packet","driver_tx_byte","driver_tx_packet",` + - `"rx_64","rx_65_127","rx_128_255","rx_256_511","rx_512_1023","rx_1024_1518","rx_1519_max",` + - `"tx_64","tx_65_127","tx_128_255","tx_256_511","tx_512_1023","tx_1024_1518","tx_1519_max",` + - `"tx_rx_64","tx_rx_65_127","tx_rx_128_255","tx_rx_256_511","tx_rx_512_1023","tx_rx_1024_1518","tx_rx_1024_max",tx_rx_1519_max",` + - `"rx_broadcast","rx_bytes","rx_control","rx_drop","rx_fcs_error","rx_fragment","rx_jabber","rx_multicast","rx_packet","rx_pause","rx_too_short","rx_too_long",` + - `"tx_broadcast","tx_bytes","tx_control","tx_drop","tx_fcs_error","tx_fragment","tx_jabber","tx_multicast","tx_packet","tx_pause","tx_too_short","tx_too_long",` + - `"rx_align_error","rx_carrier_error","rx_code_error","rx_error_events","rx_length_error","rx_overflow","rx_unicast","rx_unknown_op"` + - `"tx_collision","tx_excessive_collision","tx_late_collision","tx_multiple_collision","tx_single_collision","tx_total_collision",` + - `"tx_deferred","tx_excessive_deferred","tx_unicast","tx_underrun"`, + MetaSkipFields: PropSkipFields("factory_name", "driver_rx_byte", "driver_rx_packet", "driver_tx_byte", "driver_tx_packet", + "rx_64", "rx_65_127", "rx_128_255", "rx_256_511", "rx_512_1023", "rx_1024_1518", "rx_1519_max", + "tx_64", "tx_65_127", "tx_128_255", "tx_256_511", "tx_512_1023", "tx_1024_1518", "tx_1519_max", + "tx_rx_64", "tx_rx_65_127", "tx_rx_128_255", "tx_rx_256_511", "tx_rx_512_1023", "tx_rx_1024_1518", "tx_rx_1024_max", "tx_rx_1519_max", + "rx_broadcast", "rx_bytes", "rx_control", "rx_drop", "rx_fcs_error", "rx_fragment", "rx_jabber", "rx_multicast", "rx_packet", "rx_pause", "rx_too_short", "rx_too_long", + "tx_broadcast", "tx_bytes", "tx_control", "tx_drop", "tx_fcs_error", "tx_fragment", "tx_jabber", "tx_multicast", "tx_packet", "tx_pause", "tx_too_short", "tx_too_long", + "rx_align_error", "rx_carrier_error", "rx_code_error", "rx_error_events", "rx_length_error", "rx_overflow", "rx_unicast", "rx_unknown_op", + "tx_collision", "tx_excessive_collision", "tx_late_collision", "tx_multiple_collision", "tx_single_collision", "tx_total_collision", + "tx_deferred", "tx_excessive_deferred", "tx_unicast", "tx_underrun", ), "advertise": { diff --git a/routeros/resource_interface_ethernet_switch.go b/routeros/resource_interface_ethernet_switch.go index a8ef2262..3569e433 100644 --- a/routeros/resource_interface_ethernet_switch.go +++ b/routeros/resource_interface_ethernet_switch.go @@ -80,14 +80,14 @@ func ResourceInterfaceEthernetSwitch() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/interface/ethernet/switch"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"switch_id","driver_rx_byte","driver_rx_packet","driver_tx_byte","driver_tx_packet",` + - `"rx_align_error","rx_broadcast","rx_bytes","rx_carrier_error","rx_code_error","rx_control","rx_drop",` + - `"rx_fcs_error","rx_fragment","rx_jabber","rx_length_error","rx_multicast","rx_packet","rx_pause",` + - `"rx_too_long","rx_too_short","rx_unknown_op","tx_broadcast","tx_bytes","tx_control","tx_deferred",` + - `"tx_drop","tx_excessive_collision","tx_excessive_deferred","tx_fcs_error","tx_fragment","tx_jabber",` + - `"tx_late_collision","tx_multicast","tx_multiple_collision","tx_packet","tx_pause","tx_rx_1024_1518",` + - `"tx_rx_128_255","tx_rx_1519_max","tx_rx_256_511","tx_rx_512_1023","tx_rx_64","tx_rx_65_127",` + - `"tx_single_collision","tx_too_long","tx_too_short","tx_total_collision"`), + MetaSkipFields: PropSkipFields("switch_id", "driver_rx_byte", "driver_rx_packet", "driver_tx_byte", "driver_tx_packet", + "rx_align_error", "rx_broadcast", "rx_bytes", "rx_carrier_error", "rx_code_error", "rx_control", "rx_drop", + "rx_fcs_error", "rx_fragment", "rx_jabber", "rx_length_error", "rx_multicast", "rx_packet", "rx_pause", + "rx_too_long", "rx_too_short", "rx_unknown_op", "tx_broadcast", "tx_bytes", "tx_control", "tx_deferred", + "tx_drop", "tx_excessive_collision", "tx_excessive_deferred", "tx_fcs_error", "tx_fragment", "tx_jabber", + "tx_late_collision", "tx_multicast", "tx_multiple_collision", "tx_packet", "tx_pause", "tx_rx_1024_1518", + "tx_rx_128_255", "tx_rx_1519_max", "tx_rx_256_511", "tx_rx_512_1023", "tx_rx_64", "tx_rx_65_127", + "tx_single_collision", "tx_too_long", "tx_too_short", "tx_total_collision"), "cpu_flow_control": { Type: schema.TypeBool, diff --git a/routeros/resource_interface_ethernet_switch_port.go b/routeros/resource_interface_ethernet_switch_port.go index fc38e018..31468788 100644 --- a/routeros/resource_interface_ethernet_switch_port.go +++ b/routeros/resource_interface_ethernet_switch_port.go @@ -65,12 +65,12 @@ func ResourceInterfaceEthernetSwitchPort() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/interface/ethernet/switch/port"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"name","rx_1024_1518","rx_128_255","rx_1519_max","rx_256_511","rx_512_1023","rx_64",` + - `"rx_65_127","rx_align_error","rx_broadcast","rx_bytes","rx_fcs_error","rx_fragment","rx_multicast","rx_overflow",` + - `"rx_pause","rx_too_long","rx_too_short","tx_1024_1518","tx_128_255","tx_1519_max","tx_256_511","tx_512_1023","tx_64",` + - `"tx_65_127","tx_broadcast","tx_bytes","tx_collision","tx_deferred","tx_excessive_collision","tx_excessive_deferred",` + - `"tx_late_collision","tx_multicast","tx_multiple_collision","tx_pause","tx_single_collision","tx_too_long","tx_underrun",` + - `"driver_tx_byte","driver_rx_packet","driver_rx_byte","driver_tx_packet"`), + MetaSkipFields: PropSkipFields("name", "rx_1024_1518", "rx_128_255", "rx_1519_max", "rx_256_511", "rx_512_1023", "rx_64", + "rx_65_127", "rx_align_error", "rx_broadcast", "rx_bytes", "rx_fcs_error", "rx_fragment", "rx_multicast", "rx_overflow", + "rx_pause", "rx_too_long", "rx_too_short", "tx_1024_1518", "tx_128_255", "tx_1519_max", "tx_256_511", "tx_512_1023", "tx_64", + "tx_65_127", "tx_broadcast", "tx_bytes", "tx_collision", "tx_deferred", "tx_excessive_collision", "tx_excessive_deferred", + "tx_late_collision", "tx_multicast", "tx_multiple_collision", "tx_pause", "tx_single_collision", "tx_too_long", "tx_underrun", + "driver_tx_byte", "driver_rx_packet", "driver_rx_byte", "driver_tx_packet"), "default_vlan_id": { Type: schema.TypeString, diff --git a/routeros/resource_interface_ethernet_switch_port_isolation.go b/routeros/resource_interface_ethernet_switch_port_isolation.go index 84f74797..e5b0d868 100644 --- a/routeros/resource_interface_ethernet_switch_port_isolation.go +++ b/routeros/resource_interface_ethernet_switch_port_isolation.go @@ -23,8 +23,8 @@ func ResourceInterfaceEthernetSwitchPortIsolation() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/interface/ethernet/switch/port-isolation"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"name"`), - MetaSetUnsetFields: PropSetUnsetFields(`"forwarding_override"`), + MetaSkipFields: PropSkipFields("name"), + MetaSetUnsetFields: PropSetUnsetFields("forwarding_override"), KeyInvalid: PropInvalidRo, KeyName: PropName("Port name."), diff --git a/routeros/resource_ip_firewall_connection_tracking.go b/routeros/resource_ip_firewall_connection_tracking.go index 87af2bca..8f0318e2 100644 --- a/routeros/resource_ip_firewall_connection_tracking.go +++ b/routeros/resource_ip_firewall_connection_tracking.go @@ -35,7 +35,7 @@ func ResourceIPConnectionTracking() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/ip/firewall/connection/tracking"), MetaId: PropId(Name), - MetaSkipFields: PropSkipFields(`"total_entries"`), + MetaSkipFields: PropSkipFields("total_entries"), "active_ipv4": { Type: schema.TypeBool, diff --git a/routeros/resource_ip_firewall_filter.go b/routeros/resource_ip_firewall_filter.go index 1a26ad0b..2f9d967b 100644 --- a/routeros/resource_ip_firewall_filter.go +++ b/routeros/resource_ip_firewall_filter.go @@ -12,10 +12,11 @@ import ( // ResourceIPFirewallFilter https://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Filter func ResourceIPFirewallFilter() *schema.Resource { resSchema := map[string]*schema.Schema{ - MetaResourcePath: PropResourcePath("/ip/firewall/filter"), - MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"bytes","packets"`), - MetaSetUnsetFields: PropSetUnsetFields(`"dst_address_list","src_address_list","in_interface_list","out_interface_list","in_bridge_port_list","out_bridge_port_list"`), + MetaResourcePath: PropResourcePath("/ip/firewall/filter"), + MetaId: PropId(Id), + MetaSkipFields: PropSkipFields("bytes", "packets"), + MetaSetUnsetFields: PropSetUnsetFields("dst_address_list", "src_address_list", "in_interface_list", + "out_interface_list", "in_bridge_port_list", "out_bridge_port_list"), "action": { Type: schema.TypeString, diff --git a/routeros/resource_ip_firewall_mangle.go b/routeros/resource_ip_firewall_mangle.go index 89122c0f..4759caa2 100644 --- a/routeros/resource_ip_firewall_mangle.go +++ b/routeros/resource_ip_firewall_mangle.go @@ -27,10 +27,11 @@ import ( // ResourceIPFirewallMangle https://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Mangle func ResourceIPFirewallMangle() *schema.Resource { resSchema := map[string]*schema.Schema{ - MetaResourcePath: PropResourcePath("/ip/firewall/mangle"), - MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"bytes","packets"`), - MetaSetUnsetFields: PropSetUnsetFields(`"dst_address_list","src_address_list","in_interface_list","out_interface_list","in_bridge_port_list","out_bridge_port_list"`), + MetaResourcePath: PropResourcePath("/ip/firewall/mangle"), + MetaId: PropId(Id), + MetaSkipFields: PropSkipFields("bytes", "packets"), + MetaSetUnsetFields: PropSetUnsetFields("dst_address_list", "src_address_list", "in_interface_list", + "out_interface_list", "in_bridge_port_list", "out_bridge_port_list"), "action": { Type: schema.TypeString, diff --git a/routeros/resource_ip_firewall_nat.go b/routeros/resource_ip_firewall_nat.go index 1be60206..971d8474 100644 --- a/routeros/resource_ip_firewall_nat.go +++ b/routeros/resource_ip_firewall_nat.go @@ -29,10 +29,11 @@ import ( // ResourceIPFirewallNat https://wiki.mikrotik.com/wiki/Manual:IP/Firewall/NAT func ResourceIPFirewallNat() *schema.Resource { resSchema := map[string]*schema.Schema{ - MetaResourcePath: PropResourcePath("/ip/firewall/nat"), - MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"bytes","packets"`), - MetaSetUnsetFields: PropSetUnsetFields(`"dst_address_list","src_address_list","in_interface_list","out_interface_list","in_bridge_port_list","out_bridge_port_list"`), + MetaResourcePath: PropResourcePath("/ip/firewall/nat"), + MetaId: PropId(Id), + MetaSkipFields: PropSkipFields("bytes", "packets"), + MetaSetUnsetFields: PropSetUnsetFields("dst_address_list", "src_address_list", "in_interface_list", + "out_interface_list", "in_bridge_port_list", "out_bridge_port_list"), "action": { Type: schema.TypeString, diff --git a/routeros/resource_ipv6_firewall_filter.go b/routeros/resource_ipv6_firewall_filter.go index eafbad83..8d297c05 100644 --- a/routeros/resource_ipv6_firewall_filter.go +++ b/routeros/resource_ipv6_firewall_filter.go @@ -12,7 +12,7 @@ func ResourceIPv6FirewallFilter() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/ipv6/firewall/filter"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"bytes","packets"`), + MetaSkipFields: PropSkipFields("bytes", "packets"), "action": { Type: schema.TypeString, diff --git a/routeros/resource_routing_ospf_area.go b/routeros/resource_routing_ospf_area.go index adc267f2..d8fe7013 100644 --- a/routeros/resource_routing_ospf_area.go +++ b/routeros/resource_routing_ospf_area.go @@ -23,7 +23,7 @@ func ResourceRoutingOspfArea() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/routing/ospf/area"), MetaId: PropId(Id), - MetaSetUnsetFields: PropSetUnsetFields(`"no_summaries"`), + MetaSetUnsetFields: PropSetUnsetFields("no_summaries"), "area_id": { Type: schema.TypeString, diff --git a/routeros/resource_routing_ospf_interface_template.go b/routeros/resource_routing_ospf_interface_template.go index 9ab8edb7..06ae7f33 100644 --- a/routeros/resource_routing_ospf_interface_template.go +++ b/routeros/resource_routing_ospf_interface_template.go @@ -36,7 +36,7 @@ func ResourceRoutingOspfInterfaceTemplate() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/routing/ospf/interface-template"), MetaId: PropId(Id), - MetaSetUnsetFields: PropSetUnsetFields(`"passive"`), + MetaSetUnsetFields: PropSetUnsetFields("passive"), "area": { Type: schema.TypeString, diff --git a/routeros/resource_system_certificate.go b/routeros/resource_system_certificate.go index abf0d25d..cd509eef 100644 --- a/routeros/resource_system_certificate.go +++ b/routeros/resource_system_certificate.go @@ -40,7 +40,7 @@ func ResourceSystemCertificate() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/certificate"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"sign"`), + MetaSkipFields: PropSkipFields("sign"), "authority": { Type: schema.TypeString, diff --git a/routeros/resource_system_user.go b/routeros/resource_system_user.go index 8bdce1af..e6abbe03 100644 --- a/routeros/resource_system_user.go +++ b/routeros/resource_system_user.go @@ -22,7 +22,7 @@ func ResourceUser() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/user"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"last_logged_in"`), + MetaSkipFields: PropSkipFields("last_logged_in"), "address": { Type: schema.TypeString, diff --git a/routeros/resource_user_manager_database.go b/routeros/resource_user_manager_database.go index 8bb73486..4cd3adab 100644 --- a/routeros/resource_user_manager_database.go +++ b/routeros/resource_user_manager_database.go @@ -17,7 +17,7 @@ func ResourceUserManagerDatabase() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/user-manager/database"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"db_size","free_disk_space"`), + MetaSkipFields: PropSkipFields("db_size", "free_disk_space"), "db_path": { Type: schema.TypeString, diff --git a/routeros/resource_user_manager_user_profile.go b/routeros/resource_user_manager_user_profile.go index 8c61d55e..6002d0d4 100644 --- a/routeros/resource_user_manager_user_profile.go +++ b/routeros/resource_user_manager_user_profile.go @@ -19,7 +19,7 @@ func ResourceUserManagerUserProfile() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/user-manager/user-profile"), MetaId: PropId(Id), - MetaSkipFields: PropSkipFields(`"end_time","state"`), + MetaSkipFields: PropSkipFields("end_time", "state"), "profile": { Type: schema.TypeString, diff --git a/routeros/resource_wifi_configuration.go b/routeros/resource_wifi_configuration.go index a9b2a6d1..1e9b9198 100644 --- a/routeros/resource_wifi_configuration.go +++ b/routeros/resource_wifi_configuration.go @@ -38,13 +38,13 @@ func ResourceWifiConfiguration() *schema.Resource { resSchema := map[string]*schema.Schema{ MetaResourcePath: PropResourcePath("/interface/wifi/configuration"), MetaId: PropId(Id), - MetaTransformSet: PropTransformSet(`"aaa": "aaa.config", "channel": "channel.config", "datapath": "datapath.config", - "interworking": "interworking.config", "security": "security.config", "steering": "steering.config"`), + MetaTransformSet: PropTransformSet("aaa: aaa.config", "channel: channel.config", "datapath: datapath.config", + "interworking: interworking.config", "security: security.config", "steering: steering.config"), "aaa": { Type: schema.TypeMap, Optional: true, - Elem: &schema.Schema{Type: schema.TypeString}, + Elem: &schema.Schema{Type: schema.TypeString}, Description: "AAA inline settings.", }, "antenna_gain": { @@ -76,8 +76,8 @@ func ResourceWifiConfiguration() *schema.Resource { }, KeyComment: PropCommentRw, "country": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, Description: "An option determines which regulatory domain restrictions are applied to an interface.", }, "datapath": { @@ -138,8 +138,8 @@ func ResourceWifiConfiguration() *schema.Resource { Description: "Security inline settings.", }, "ssid": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, Description: "SSID (service set identifier) is a name broadcast in the beacons that identifies wireless network.", }, "steering": {