Skip to content

Commit

Permalink
feat: Add MLAG settings
Browse files Browse the repository at this point in the history
Fixes #268
  • Loading branch information
vaerh committed Nov 2, 2023
1 parent 419f093 commit 6b8cfd2
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/resources/routeros_bridge_mlag/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import routeros_ip_cloud.test .
4 changes: 4 additions & 0 deletions examples/resources/routeros_bridge_mlag/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "routeros_bridge_mlag" "mlag" {
bridge = "bridge1"
peer_port = "stack-link"
}
1 change: 1 addition & 0 deletions routeros/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func Provider() *schema.Provider {

// Aliases for interface objects to retain compatibility between original and fork
"routeros_bridge": ResourceInterfaceBridge(),
"routeros_bridge_mlag": ResourceInterfaceBridgeMlag(),
"routeros_bridge_port": ResourceInterfaceBridgePort(),
"routeros_bridge_vlan": ResourceInterfaceBridgeVlan(),
"routeros_gre": ResourceInterfaceGre(),
Expand Down
9 changes: 9 additions & 0 deletions routeros/resource_interface_bridge_mlag _test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package routeros

import (
"testing"
)

func TestAccInterfaceBridgeMlagTest_basic(t *testing.T) {
t.Log("Test skipped, The test is skipped, the resource is only available on real hardware.")
}
47 changes: 47 additions & 0 deletions routeros/resource_interface_bridge_mlag.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package routeros

import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

/*
{
"bridge":"bridge1",
"peer-port":"stack-link"
}
*/

// https://help.mikrotik.com/docs/display/ROS/Multi-chassis+Link+Aggregation+Group
func ResourceInterfaceBridgeMlag() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/interface/bridge/mlag"),
MetaId: PropId(Id),

"bridge": {
Type: schema.TypeString,
Required: true,
Description: "The bridge interface where MLAG is being created.",
},
"peer_port": {
Type: schema.TypeString,
Required: true,
Description: "An interface that will be used as a peer port. Both peer devices are using inter-chassis " +
"communication over these peer ports to establish MLAG and update the host table. Peer port should be " +
"isolated on a different untagged VLAN using a pvid setting. Peer port can be configured as a bonding " +
"interface.",
},
}

return &schema.Resource{
CreateContext: DefaultSystemCreate(resSchema),
ReadContext: DefaultSystemRead(resSchema),
UpdateContext: DefaultSystemUpdate(resSchema),
DeleteContext: DefaultSystemDelete(resSchema),

Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},

Schema: resSchema,
}
}

0 comments on commit 6b8cfd2

Please sign in to comment.