-
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: Add system user authentication and accounting settings resource
- Loading branch information
Showing
4 changed files
with
73 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 @@ | ||
terraform import routeros_system_user_aaa.settings . |
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 @@ | ||
resource "routeros_system_user_aaa" "settings" { | ||
use_radius = true | ||
} |
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,68 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
/* | ||
{ | ||
"accounting": "true", | ||
"default-group": "read", | ||
"exclude-groups": "full", | ||
"interim-update": "0s", | ||
"use-radius": "false" | ||
} | ||
*/ | ||
|
||
// https://help.mikrotik.com/docs/display/ROS/User#User-RemoteAAA | ||
func ResourceUserAaa() *schema.Resource { | ||
resSchema := map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/user/aaa"), | ||
MetaId: PropId(Id), | ||
|
||
"accounting": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: true, | ||
Description: "An option that enables accounting for users.", | ||
}, | ||
"default_group": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "read", | ||
Description: "The user group that is used by default for users authenticated via a RADIUS server.", | ||
}, | ||
"exclude_groups": { | ||
Type: schema.TypeSet, | ||
Optional: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
Description: "A set of groups that are not allowed for users authenticated by RADIUS.", | ||
}, | ||
"interim_update": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "0s", | ||
Description: "Interval between scheduled RADIUS Interim-Update messages.", | ||
DiffSuppressFunc: TimeEquall, | ||
}, | ||
"use_radius": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Default: false, | ||
Description: "An option whether to use RADIUS server.", | ||
}, | ||
} | ||
|
||
return &schema.Resource{ | ||
CreateContext: DefaultSystemCreate(resSchema), | ||
ReadContext: DefaultSystemRead(resSchema), | ||
UpdateContext: DefaultSystemUpdate(resSchema), | ||
DeleteContext: DefaultSystemDelete(resSchema), | ||
|
||
Importer: &schema.ResourceImporter{ | ||
StateContext: schema.ImportStatePassthroughContext, | ||
}, | ||
|
||
Schema: resSchema, | ||
} | ||
} |