-
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.
feat: Add Wifi accounting and authentication resource
- Loading branch information
Showing
4 changed files
with
91 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/aaa get [print show-ids]] | ||
terraform import routeros_wifi_aaa.aaa1 '*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,6 @@ | ||
resource "routeros_wifi_aaa" "aaa1" { | ||
called_format = "S" | ||
name = "aaa1" | ||
password_format = "" | ||
username_format = "AA:AA:AA:AA:AA:AA" | ||
} |
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,81 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
/* | ||
{ | ||
".id": "*1", | ||
"called-format": "II-II-II-II-II-II:S", | ||
"calling-format": "AA-AA-AA-AA-AA-AA", | ||
"disabled": "false", | ||
"interim-update": "disabled", | ||
"mac-caching": "disabled", | ||
"name": "aaa1", | ||
"nas-identifier": "router", | ||
"password-format": "", | ||
"username-format": "AA:AA:AA:AA:AA:AA" | ||
} | ||
*/ | ||
|
||
// https://help.mikrotik.com/docs/display/ROS/WiFi#WiFi-AAAproperties | ||
func ResourceWifiAaa() *schema.Resource { | ||
resSchema := map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/interface/wifi/aaa"), | ||
MetaId: PropId(Id), | ||
|
||
"called_format": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Format of the `Called-Station-Id` RADIUS attribute.", | ||
}, | ||
"calling_format": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Format of the `Calling-Station-Id` RADIUS attribute.", | ||
}, | ||
KeyComment: PropCommentRw, | ||
KeyDisabled: PropDisabledRw, | ||
"interim_update": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Interval at which to send interim updates about traffic accounting to the RADIUS server.", | ||
}, | ||
"mac_caching": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Time to cache RADIUS server replies when MAC address authentication is enabled.", | ||
}, | ||
KeyName: PropName("Name of the AAA profile."), | ||
"nas_identifier": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Value of the `NAS-Identifier` RADIUS attribute.", | ||
}, | ||
"password_format": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Format of the `User-Password` RADIUS attribute.", | ||
}, | ||
"username_format": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Format of the `User-Name` RADIUS attribute.", | ||
}, | ||
} | ||
|
||
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, | ||
} | ||
} |