Skip to content

Commit

Permalink
Merge pull request #171 from terraform-routeros/capsman
Browse files Browse the repository at this point in the history
feat: CAPsMAN resource support
  • Loading branch information
vaerh authored Apr 3, 2023
2 parents c749472 + fe4e993 commit aca3884
Show file tree
Hide file tree
Showing 87 changed files with 2,072 additions and 1,007 deletions.
1 change: 1 addition & 0 deletions examples/resources/routeros_capsman_aaa/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import routeros_capsman_aaa.test_3a .
4 changes: 4 additions & 0 deletions examples/resources/routeros_capsman_aaa/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "routeros_capsman_aaa" "test_3a" {
called_format = "ssid"
mac_mode = "as-username-and-password"
}
2 changes: 2 additions & 0 deletions examples/resources/routeros_capsman_channel/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import with the name of the CAPsMAN channel configuration in case of the example use test-channel-config
terraform import routeros_capsman_channel.test_channel test-channel-config
13 changes: 13 additions & 0 deletions examples/resources/routeros_capsman_channel/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "routeros_capsman_channel" "test_channel" {
name = "test_channel"
comment = "test_channel"
band = "2ghz-b/g/n"
control_channel_width = "10mhz"
extension_channel = "eCee"
frequency = 2412
reselect_interval = "1h"
save_selected = true
secondary_frequency = "disabled"
skip_dfs_channels = true
tx_power = 20
}
2 changes: 2 additions & 0 deletions examples/resources/routeros_capsman_configuration/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import with the name of the CAPsMAN configuration in case of the example use test_configuration_name
terraform import routeros_capsman_configuration.test_configuration_2 test_configuration_name
101 changes: 101 additions & 0 deletions examples/resources/routeros_capsman_configuration/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
resource "routeros_capsman_configuration" "test_configuration" {
comment = "Comment"
country = "no_country_set"
disconnect_timeout = "1s150ms"
distance = "indoors"
frame_lifetime = "0.12" // 120ms
guard_interval = "long"
hide_ssid = true
hw_protection_mode = "rts-cts"
hw_retries = 1
installation = "indoor"
keepalive_frames = "enabled"
load_balancing_group = ""
max_sta_count = 1
mode = "ap"
multicast_helper = "full"
name = "test_configuration"
rx_chains = [1, 3]
ssid = "SSID"
tx_chains = [0, 2]
}

resource "routeros_capsman_channel" "test_channel" {
name = "test-channel-config"
}

resource "routeros_capsman_datapath" "test_datapath" {
name = "test-datapath-config"
}

resource "routeros_capsman_rates" "test_rates" {
name = "test-rates-config"
}

resource "routeros_capsman_security" "test_security" {
name = "test-security-config"
}

resource "routeros_capsman_configuration" "test_configuration_2" {
name = "test_configuration_name"

channel = {
config = "${routeros_capsman_channel.test_channel.name}"
band = "2ghz-b/g/n"
control_channel_width = "10mhz"
extension_channel = "eCee"
frequency = 2412
reselect_interval = "1h"
save_selected = "true"
secondary_frequency = "disabled"
skip_dfs_channels = "true"
tx_power = 20
}

datapath = {
config = "${routeros_capsman_datapath.test_datapath.name}"
arp = "local-proxy-arp"
bridge = "bridge"
bridge_cost = "100"
bridge_horizon = "200"
client_to_client_forwarding = "true"
interface_list = "static"
l2mtu = "1450"
local_forwarding = "true"
mtu = "1500"
vlan_id = "101"
vlan_mode = "no-tag"
// openflow_switch = "aaa"
}

rates = {
config = "${routeros_capsman_rates.test_rates.name}"
basic = "1Mbps,5.5Mbps,6Mbps,18Mbps,36Mbps,54Mbps"
ht_basic_mcs = "mcs-0,mcs-7,mcs-11,mcs-14,mcs-16,mcs-21"
ht_supported_mcs = "mcs-3,mcs-8,mcs-10,mcs-13,mcs-17,mcs-18"
supported = "2Mbps,11Mbps,9Mbps,12Mbps,24Mbps,48Mbps"
vht_basic_mcs = "none"
vht_supported_mcs = "mcs0-9,mcs0-7"
}

security = {
config = "${routeros_capsman_security.test_security.name}"
authentication_types = "wpa-psk,wpa-eap"
disable_pmkid = "true"
eap_methods = "eap-tls,passthrough"
eap_radius_accounting = "true"
encryption = "aes-ccm,tkip"
group_encryption = "aes-ccm"
group_key_update = "1h"
passphrase = "AAAAAAAAA"
tls_certificate = "none"
tls_mode = "verify-certificate"
}

depends_on = [
routeros_capsman_channel.test_channel,
routeros_capsman_datapath.test_datapath,
routeros_capsman_rates.test_rates,
routeros_capsman_security.test_security
]
}
2 changes: 2 additions & 0 deletions examples/resources/routeros_capsman_datapath/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import with the name of the CAPsMAN datapath configuration in case of the example use test-datapath-config
terraform import routeros_capsman_datapath.test_datapath test-datapath-config
16 changes: 16 additions & 0 deletions examples/resources/routeros_capsman_datapath/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resource "routeros_capsman_datapath" "test_datapath" {
name = "test_datapath"
comment = "test_datapath"
arp = "local-proxy-arp"
bridge = "bridge"
bridge_cost = 100
bridge_horizon = 200
client_to_client_forwarding = true
interface_list = "static"
l2mtu = 1450
local_forwarding = true
mtu = 1500
vlan_id = 101
vlan_mode = "no-tag"
// openflow_switch = "aaa"
}
1 change: 1 addition & 0 deletions examples/resources/routeros_capsman_manager/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import routeros_capsman_manager.test_manager .
4 changes: 4 additions & 0 deletions examples/resources/routeros_capsman_manager/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "routeros_capsman_manager" "test_manager" {
enabled = true
upgrade_policy = "require-same-version"
}
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 [/caps-man/manager/interface get [print show-ids]]
terraform import routeros_capsman_manager_interface.test_manager_interface "*6"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "routeros_capsman_manager_interface" "test_manager_interface" {
interface = "ether1"
forbid = true
}
3 changes: 3 additions & 0 deletions examples/resources/routeros_capsman_provisioning/import.sh
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 [/caps-man/provisioning get [print show-ids]]
terraform import routeros_capsman_provisioning.test_provisioning "*B"
13 changes: 13 additions & 0 deletions examples/resources/routeros_capsman_provisioning/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "routeros_capsman_configuration" "test_configuration" {
name = "cfg1"
}

resource "routeros_capsman_provisioning" "test_provisioning" {
master_configuration = "cfg1"
action = "create-disabled"
name_prefix = "cap-"

depends_on = [
routeros_capsman_configuration.test_configuration,
]
}
2 changes: 2 additions & 0 deletions examples/resources/routeros_capsman_rates/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import with the name of the CAPsMAN rates configuration in case of the example use test-rates-config
terraform import routeros_capsman_rates.test_rates test-rates-config
10 changes: 10 additions & 0 deletions examples/resources/routeros_capsman_rates/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "routeros_capsman_rates" "test_rates" {
name = "test_rates"
comment = "test_rates"
basic = ["1Mbps", "5.5Mbps", "6Mbps", "18Mbps", "36Mbps", "54Mbps"]
ht_basic_mcs = ["mcs-0", "mcs-7", "mcs-11", "mcs-14", "mcs-16", "mcs-21"]
ht_supported_mcs = ["mcs-3", "mcs-8", "mcs-10", "mcs-13", "mcs-17", "mcs-18"]
supported = ["2Mbps", "11Mbps", "9Mbps", "12Mbps", "24Mbps", "48Mbps"]
vht_basic_mcs = "none"
vht_supported_mcs = "mcs0-9,mcs0-7"
}
2 changes: 2 additions & 0 deletions examples/resources/routeros_capsman_security/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Import with the name of the CAPsMAN security profile in case of the example use test-security-config
terraform import routeros_capsman_security.test_security test-security-config
14 changes: 14 additions & 0 deletions examples/resources/routeros_capsman_security/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "routeros_capsman_security" "test_security" {
name = "test_security"
comment = "test_security"
authentication_types = ["wpa-psk", "wpa-eap", "wpa2-psk"]
disable_pmkid = true
eap_methods = "eap-tls,passthrough"
eap_radius_accounting = true
encryption = ["tkip", "aes-ccm"]
group_encryption = "aes-ccm"
group_key_update = "1h"
passphrase = "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDE"
tls_certificate = "none"
tls_mode = "verify-certificate"
}
3 changes: 1 addition & 2 deletions examples/resources/routeros_system_identity/import.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
#The system identity can not be imported.
#Terraform will ignore the current name and will overwrite the current with the one defined in Terraform.
terraform import routeros_system_identity.identity .
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/gnewbury1/terraform-provider-routeros
module github.com/terraform-routeros/terraform-provider-routeros

go 1.19

Expand All @@ -25,7 +25,7 @@ require (
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.4.0 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.8 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
Expand All @@ -36,6 +36,7 @@ require (
github.com/hashicorp/terraform-exec v0.18.1 // indirect
github.com/hashicorp/terraform-json v0.16.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.14.3 // indirect
github.com/hashicorp/terraform-plugin-testing v1.2.0
github.com/hashicorp/terraform-registry-address v0.1.0 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I=
github.com/hashicorp/go-hclog v1.4.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
Expand Down Expand Up @@ -108,6 +108,8 @@ github.com/hashicorp/terraform-plugin-log v0.8.0 h1:pX2VQ/TGKu+UU1rCay0OlzosNKe4
github.com/hashicorp/terraform-plugin-log v0.8.0/go.mod h1:1myFrhVsBLeylQzYYEV17VVjtG8oYPRFdaZs7xdW2xs=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 h1:G9WAfb8LHeCxu7Ae8nc1agZlQOSCUWsb610iAogBhCs=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1/go.mod h1:xcOSYlRVdPLmDUoqPhO9fiO/YCN/l6MGYeTzGt5jgkQ=
github.com/hashicorp/terraform-plugin-testing v1.2.0 h1:pASRAe6BOZFO4xSGQr9WzitXit0nrQAYDk8ziuRfn9E=
github.com/hashicorp/terraform-plugin-testing v1.2.0/go.mod h1:+8bp3O7xUb1UtBcdknrGdVRIuTw4b62TYSIgXHqlyew=
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"flag"

"github.com/gnewbury1/terraform-provider-routeros/routeros"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"github.com/terraform-routeros/terraform-provider-routeros/routeros"
)

// Generate the Terraform provider documentation using `tfplugindocs`:
Expand Down
87 changes: 0 additions & 87 deletions routeros/capsman/resource_capsman_channel.go

This file was deleted.

Loading

0 comments on commit aca3884

Please sign in to comment.