-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#The ID can be found via API or the terminal | ||
#The command for the terminal is -> :put [/interface/wifi/datapath get [print show-ids]] | ||
terraform import routeros_wifi_datapath.datapath1 '*1' |
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,5 @@ | ||
resource "routeros_wifi_datapath" "datapath1" { | ||
name = "datapath1" | ||
bridge = "bridge1" | ||
client_isolation = false | ||
} |
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,75 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
/* | ||
{ | ||
".id": "*1", | ||
"bridge": "lan", | ||
"bridge-cost": "1", | ||
"bridge-horizon": "none", | ||
"client-isolation": "true", | ||
"disabled": "false", | ||
"interface-list": "LAN", | ||
"name": "datapath1", | ||
"vlan-id": "1" | ||
} | ||
*/ | ||
|
||
// https://help.mikrotik.com/docs/display/ROS/WiFi#WiFi-Datapathproperties | ||
func ResourceWifiDatapath() *schema.Resource { | ||
resSchema := map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/interface/wifi/datapath"), | ||
MetaId: PropId(Id), | ||
|
||
"bridge": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Bridge interface to add the interface as a bridge port.", | ||
}, | ||
"bridge_cost": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Spanning tree protocol cost of the bridge port.", | ||
}, | ||
"bridge_horizon": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Bridge horizon to use when adding as a bridge port.", | ||
}, | ||
"client_isolation": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Description: "An option to toggle communication between clients connected to the same AP.", | ||
}, | ||
KeyComment: PropCommentRw, | ||
KeyDisabled: PropDisabledRw, | ||
"interface_list": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "List to which add the interface as a member.", | ||
}, | ||
KeyName: PropName("Name of the datapath."), | ||
"vlan_id": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Default VLAN ID to assign to client devices connecting to this interface.", | ||
}, | ||
} | ||
|
||
return &schema.Resource{ | ||
Description: `*<span style="color:red">This resource requires a minimum version of RouterOS 7.13.</span>*`, | ||
CreateContext: DefaultCreate(resSchema), | ||
ReadContext: DefaultRead(resSchema), | ||
UpdateContext: DefaultUpdate(resSchema), | ||
DeleteContext: DefaultDelete(resSchema), | ||
|
||
Importer: &schema.ResourceImporter{ | ||
StateContext: schema.ImportStatePassthroughContext, | ||
}, | ||
|
||
Schema: resSchema, | ||
} | ||
} |