-
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.
Merge pull request #558 from terraform-routeros/adlist
- Loading branch information
Showing
44 changed files
with
2,098 additions
and
41 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
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
resource "routeros_dns_adlist" "test" { | ||
resource "routeros_ip_dns_adlist" "test" { | ||
url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" | ||
ssl_verify = 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
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 [/ip/hotspot get [print show-ids]] | ||
terraform import routeros_ip_hotspot.test *3 |
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,4 @@ | ||
resource "routeros_ip_hotspot" "test" { | ||
name = "server-1" | ||
interface = "ether2" | ||
} |
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 [/ip/hotspot/ip-binding get [print show-ids]] | ||
terraform import routeros_ip_hotspot_ip_binding.test *3 |
6 changes: 6 additions & 0 deletions
6
examples/resources/routeros_ip_hotspot_ip_binding/resource.tf
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_ip_hotspot_ip_binding" "test" { | ||
address = "0.0.0.1" | ||
comment = "comment" | ||
mac_address = "00:00:00:00:01:10" | ||
to_address = "0.0.0.2" | ||
} |
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 [/ip/hotspot/profile get [print show-ids]] | ||
terraform import routeros_ip_hotspot_profile.test *3 |
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_ip_hotspot_profile" "test" { | ||
name = "hsprof-1" | ||
login_by = ["mac", "https", "trial"] | ||
use_radius = true | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/resources/routeros_ip_hotspot_service_port/import.sh
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 [/ip/hotspot/service-port get [print show-ids]] | ||
terraform import routeros_ip_hotspot_service_port.test *1 |
4 changes: 4 additions & 0 deletions
4
examples/resources/routeros_ip_hotspot_service_port/resource.tf
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,4 @@ | ||
resource "routeros_ip_hotspot_service_port" "test" { | ||
name = "ftp" | ||
disabled = 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
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 [/ip/hotspot/user get [print show-ids]] | ||
terraform import routeros_ip_hotspot_user.test *3 |
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_ip_hotspot_user" "test" { | ||
name = "user-1" | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/resources/routeros_ip_hotspot_user_profile/import.sh
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 [/ip/hotspot/user/profile get [print show-ids]] | ||
terraform import routeros_ip_hotspot_user_profile.test *3 |
12 changes: 12 additions & 0 deletions
12
examples/resources/routeros_ip_hotspot_user_profile/resource.tf
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,12 @@ | ||
resource "routeros_ip_hotspot_user_profile" "test" { | ||
add_mac_cookie = true | ||
address_list = "list-1" | ||
idle_timeout = "none" | ||
keepalive_timeout = "2m" | ||
mac_cookie_timeout = "3d" | ||
name = "new-profile" | ||
shared_users = 3 | ||
status_autorefresh = "2m" | ||
transparent_proxy = true | ||
advertise = true | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/resources/routeros_ip_hotspot_walled_garden/import.sh
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 [/ip/hotspot/walled-garden get [print show-ids]] | ||
terraform import routeros_ip_hotspot_walled_garden.test *3 |
5 changes: 5 additions & 0 deletions
5
examples/resources/routeros_ip_hotspot_walled_garden/resource.tf
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_ip_hotspot_walled_garden" "test" { | ||
action = "deny" | ||
dst_host = "1.2.3.4" | ||
dst_port = "!443" | ||
} |
3 changes: 3 additions & 0 deletions
3
examples/resources/routeros_ip_hotspot_walled_garden_ip/import.sh
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 [/ip/hotspot/walled-garden/ip get [print show-ids]] | ||
terraform import routeros_ip_hotspot_walled_garden_ip.test *3 |
9 changes: 9 additions & 0 deletions
9
examples/resources/routeros_ip_hotspot_walled_garden_ip/resource.tf
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,9 @@ | ||
resource "routeros_ip_hotspot_walled_garden_ip" "test" { | ||
action = "reject" | ||
dst_address = "!0.0.0.0" | ||
dst_address_list = "dlist" | ||
dst_port = "0-65535" | ||
protocol = "tcp" | ||
src_address = "0.0.0.0" | ||
src_address_list = "slist" | ||
} |
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_tool_sniffer.test . |
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,9 @@ | ||
resource "routeros_tool_sniffer" "test" { | ||
streaming_enabled = true | ||
streaming_server = "192.168.88.5:37008" | ||
filter_stream = true | ||
|
||
filter_interface = ["ether2"] | ||
filter_direction = "rx" | ||
filter_operator_between_entries = "and" | ||
} |
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
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,95 @@ | ||
package routeros | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
/* | ||
{ | ||
".id": "*5", | ||
"HTTPS": "false", | ||
"addresses-per-mac": "unlimited", | ||
"disabled": "false", | ||
"idle-timeout": "5m", | ||
"interface": "ether4", | ||
"invalid": "false", | ||
"keepalive-timeout": "none", | ||
"login-timeout": "none", | ||
"name": "server1", | ||
"profile": "default", | ||
"proxy-status": "running" | ||
} | ||
*/ | ||
|
||
// https://help.mikrotik.com/docs/pages/viewpage.action?pageId=56459266#HotSpot(Captiveportal)-IPHotSpot | ||
func ResourceIpHotspot() *schema.Resource { | ||
resSchema := map[string]*schema.Schema{ | ||
MetaResourcePath: PropResourcePath("/ip/hotspot"), | ||
MetaId: PropId(Id), | ||
MetaSkipFields: PropSkipFields("HTTPS", "keepalive-timeout", "proxy_status"), | ||
|
||
"address_pool": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Address space used to change HotSpot client any IP address to a valid address. Useful for " + | ||
"providing public network access to mobile clients that are not willing to change their networking settings.", | ||
}, | ||
"addresses_per_mac": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Number of IP addresses allowed to be bind with the MAC address, when multiple HotSpot clients " + | ||
"connected with one MAC-address.", | ||
DiffSuppressFunc: AlwaysPresentNotUserProvided, | ||
}, | ||
KeyDisabled: PropDisabledRw, | ||
"idle_timeout": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Period of inactivity for unauthorized clients. When there is no traffic from this client (literally " + | ||
"client computer should be switched off), once the timeout is reached, a user is dropped from the HotSpot " + | ||
"host list, its used address becomes available.", | ||
DiffSuppressFunc: TimeEquall, | ||
}, | ||
"interface": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: "Interface to run HotSpot on.", | ||
}, | ||
KeyInvalid: PropInvalidRo, | ||
"keepalive_timeout": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The exact value of the keepalive-timeout, that is applied to the user. Value shows how long " + | ||
"the host can stay out of reach to be removed from the HotSpot.", | ||
DiffSuppressFunc: TimeEquall, | ||
}, | ||
"login_timeout": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "Period of time after which if a host hasn't been authorized itself with a system the host " + | ||
"entry gets deleted from host table. Loop repeats until the host logs in the system. Enable if there " + | ||
"are situations where a host cannot log in after being too long in the host table unauthorized.", | ||
DiffSuppressFunc: TimeEquall, | ||
}, | ||
KeyName: PropName("HotSpot server's name or identifier."), | ||
"profile": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "HotSpot server default HotSpot profile, which is located in `/ip/hotspot/profile`.", | ||
DiffSuppressFunc: AlwaysPresentNotUserProvided, | ||
}, | ||
} | ||
|
||
return &schema.Resource{ | ||
CreateContext: DefaultCreate(resSchema), | ||
ReadContext: DefaultRead(resSchema), | ||
UpdateContext: DefaultUpdate(resSchema), | ||
DeleteContext: DefaultDelete(resSchema), | ||
|
||
Importer: &schema.ResourceImporter{ | ||
StateContext: schema.ImportStatePassthroughContext, | ||
}, | ||
|
||
Schema: resSchema, | ||
} | ||
} |
Oops, something went wrong.