Skip to content

Commit

Permalink
feat: Add RADIUS incoming resource
Browse files Browse the repository at this point in the history
  • Loading branch information
dokmic authored and vaerh committed Nov 15, 2023
1 parent eb0b5c3 commit 6fb0a23
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/resources/routeros_radius_incoming/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import routeros_radius_incoming.settings .
3 changes: 3 additions & 0 deletions examples/resources/routeros_radius_incoming/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resource "routeros_radius_incoming" "settings" {
accept = true
}
1 change: 1 addition & 0 deletions routeros/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func Provider() *schema.Provider {

// RADIUS
"routeros_radius": ResourceRadius(),
"routeros_radius_incoming": ResourceRadiusIncoming(),

// SNMP
"routeros_snmp": ResourceSNMP(),
Expand Down
41 changes: 41 additions & 0 deletions routeros/resource_radius.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,44 @@ func ResourceRadius() *schema.Resource {
Schema: resSchema,
}
}

// https://help.mikrotik.com/docs/display/ROS/RADIUS#RADIUS-ConnectionTerminatingfromRADIUS
func ResourceRadiusIncoming() *schema.Resource {
resSchema := map[string]*schema.Schema{
MetaResourcePath: PropResourcePath("/radius/incoming"),
MetaId: PropId(Name),

"accept": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "An option whether to accept the unsolicited messages.",
},
"port": {
Type: schema.TypeInt,
Optional: true,
Default: 3799,
Description: "The port number to listen for the requests on.",
ValidateFunc: validation.IntBetween(0, 65535),
},
"vrf": {
Type: schema.TypeString,
Optional: true,
Default: "main",
Description: "VRF on which service is listening for incoming connections.",
},
}

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 6fb0a23

Please sign in to comment.