-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update the
vlan_ids
property in `routeros_interface_bridge_vl…
…an` to support multiple values
- Loading branch information
Showing
5 changed files
with
115 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
/* | ||
[ | ||
{ | ||
".id": "*1", | ||
"bridge": "bridge", | ||
"comment": "Management", | ||
"current-tagged": "bridge,ether2,ether3", | ||
"current-untagged": "", | ||
"disabled": "false", | ||
"dynamic": "false", | ||
"tagged": "ether2,ether4,ether5,bridge,ether3", | ||
"untagged": "", | ||
"vlan-ids": "2" | ||
}, | ||
{...} | ||
] | ||
*/ | ||
|
||
// ResourceInterfaceBridgeVlan https://wiki.mikrotik.com/wiki/Manual:Interface/Bridge#Bridge_VLAN_Filtering | ||
func ResourceInterfaceBridgeVlanV0() *schema.Resource { | ||
resSchema := map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/interface/bridge/vlan"), | ||
MetaId: PropId(Id), | ||
MetaSkipFields: PropSkipFields("debug_info"), | ||
|
||
"bridge": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: "The bridge interface which the respective VLAN entry is intended for.", | ||
}, | ||
KeyComment: PropCommentRw, | ||
"current_tagged": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
}, | ||
"current_untagged": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
}, | ||
KeyDisabled: PropDisabledRw, | ||
KeyDynamic: PropDynamicRo, | ||
"mvrp_forbidden": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
Description: "Ports that ignore all MRP messages and remains Not Registered (MT), as well as disables applicant from declaring specific VLAN ID (available since RouterOS 7.15).", | ||
DiffSuppressFunc: AlwaysPresentNotUserProvided, | ||
}, | ||
"tagged": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
Description: "Interface list with a VLAN tag adding action in egress. This setting accepts comma " + | ||
"separated values. E.g. tagged=ether1,ether2.", | ||
}, | ||
"untagged": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
}, | ||
Description: "Interface list with a VLAN tag removing action in egress. This setting accepts comma " + | ||
"separated values. E.g. untagged=ether3,ether4", | ||
}, | ||
"vlan_ids": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: "The list of VLAN IDs for certain port configuration. This setting accepts VLAN ID range " + | ||
"as well as comma separated values. E.g. vlan-ids=100-115,120,122,128-130.", | ||
}, | ||
} | ||
|
||
return &schema.Resource{ | ||
CreateContext: DefaultCreate(resSchema), | ||
ReadContext: DefaultRead(resSchema), | ||
UpdateContext: DefaultUpdate(resSchema), | ||
DeleteContext: DefaultDelete(resSchema), | ||
Importer: &schema.ResourceImporter{ | ||
StateContext: schema.ImportStatePassthroughContext, | ||
}, | ||
|
||
Schema: resSchema, | ||
} | ||
} |