-
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.
- Loading branch information
Showing
4 changed files
with
90 additions
and
6 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/channel get [print show-ids]] | ||
terraform import routeros_wifi_channel.channel1 '*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,8 @@ | ||
resource "routeros_wifi_channel" "channel1" { | ||
name = "1" | ||
band = "2ghz-n" | ||
frequency = [2412] | ||
secondary_frequency = ["disabled"] | ||
skip_dfs_channels = "disabled" | ||
width = "20mhz" | ||
} |
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,76 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
) | ||
|
||
/* | ||
{ | ||
".id": "*1", | ||
"band": "2ghz-n", | ||
"disabled": "false", | ||
"frequency": "2412", | ||
"name": "channel1", | ||
"secondary-frequency": "disabled", | ||
"skip-dfs-channels": "disabled", | ||
"width": "20mhz" | ||
} | ||
*/ | ||
|
||
// https://help.mikrotik.com/docs/display/ROS/WiFi#WiFi-Channelproperties | ||
func ResourceWifiChannel() *schema.Resource { | ||
resSchema := map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/interface/wifi/channel"), | ||
MetaId: PropId(Id), | ||
|
||
"band": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Frequency band and wireless standard that will be used by the AP. ", | ||
ValidateFunc: validation.StringInSlice([]string{"2ghz-g", "2ghz-n", "2ghz-ax", "5ghz-a", "5ghz-ac", "5ghz-an", "5ghz-ax"}, false), | ||
}, | ||
KeyComment: PropCommentRw, | ||
KeyDisabled: PropDisabledRw, | ||
"frequency": { | ||
Type: schema.TypeList, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
Optional: true, | ||
Description: "Channel frequency value or range in MHz on which AP or station will operate.", | ||
}, | ||
KeyName: PropName("Name of the channel."), | ||
"secondary_frequency": { | ||
Type: schema.TypeList, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
Optional: true, | ||
Description: "Specifies the second frequency that will be used for 80+80MHz configuration. " + | ||
"Set it to `disabled` in order to disable 80+80MHz capability.", | ||
}, | ||
"skip_dfs_channels": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "An option to avoid using channels on which channel availability check (listening for the presence of radar signals) is required.", | ||
ValidateFunc: validation.StringInSlice([]string{"10min-cac", "all", "disabled"}, false), | ||
}, | ||
"width": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Channel width.", | ||
ValidateFunc: validation.StringInSlice([]string{"20mhz", "20/40mhz", "20/40mhz-Ce", "20/40mhz-eC", "20/40/80mhz", "20/40/80+80mhz", "20/40/80/160mhz"}, false), | ||
}, | ||
} | ||
|
||
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, | ||
} | ||
} |