Add additional atts to wlan
This commit is contained in:
@@ -38,6 +38,7 @@ resource "unifi_wlan" "test" {
|
||||
passphrase = "12345678"
|
||||
wlan_group_id = data.unifi_wlan_group.default.id
|
||||
user_group_id = data.unifi_user_group.default.id
|
||||
security = "wpapsk"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -18,7 +18,10 @@ func TestAccNetwork_basic(t *testing.T) {
|
||||
// testCheckNetworkExists(t, "name"),
|
||||
),
|
||||
},
|
||||
importStep("unifi_network.test", "dhcp_enabled", "dhcp_lease", "dhcp_start", "dhcp_stop", "name", "network_group", "purpose", "subnet", "vlan_id"),
|
||||
importStep("unifi_network.test",
|
||||
"dhcp_enabled", "dhcp_lease", "dhcp_start", "dhcp_stop", "name",
|
||||
"network_group", "purpose", "subnet", "vlan_id",
|
||||
),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
|
||||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
|
||||
|
||||
"github.com/paultyng/terraform-provider-unifi/unifi"
|
||||
)
|
||||
@@ -28,11 +29,6 @@ func resourceWLAN() *schema.Resource {
|
||||
Optional: true,
|
||||
Default: 1,
|
||||
},
|
||||
"passphrase": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
Sensitive: true,
|
||||
},
|
||||
"wlan_group_id": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
@@ -41,6 +37,25 @@ func resourceWLAN() *schema.Resource {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
},
|
||||
"security": {
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: validation.StringInSlice([]string{"wpapsk", "wpaeap", "open"}, false),
|
||||
},
|
||||
"passphrase": {
|
||||
Type: schema.TypeString,
|
||||
// only required if security != open
|
||||
Optional: true,
|
||||
Sensitive: true,
|
||||
},
|
||||
"hide_ssid": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
"is_guest": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -48,30 +63,30 @@ func resourceWLAN() *schema.Resource {
|
||||
func resourceWLANCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
c := meta.(*client)
|
||||
|
||||
vlan := d.Get("vlan_id").(int)
|
||||
|
||||
req := &unifi.WLAN{
|
||||
Name: d.Get("name").(string),
|
||||
VLAN: fmt.Sprintf("%d", d.Get("vlan_id").(int)),
|
||||
VLAN: fmt.Sprintf("%d", vlan),
|
||||
XPassphrase: d.Get("passphrase").(string),
|
||||
|
||||
HideSSID: d.Get("hide_ssid").(bool),
|
||||
IsGuest: d.Get("is_guest").(bool),
|
||||
WLANGroupID: d.Get("wlan_group_id").(string),
|
||||
UserGroupID: d.Get("user_group_id").(string),
|
||||
Security: d.Get("security").(string),
|
||||
|
||||
VLANEnabled: vlan != 0,
|
||||
|
||||
// TODO: add to schema
|
||||
WPAEnc: "ccmp",
|
||||
WPAMode: "wpa2",
|
||||
Enabled: true,
|
||||
NameCombineEnabled: true,
|
||||
|
||||
Enabled: true,
|
||||
VLANEnabled: true,
|
||||
WPAEnc: "ccmp",
|
||||
Security: "wpapsk",
|
||||
WPAMode: "wpa2",
|
||||
NameCombineEnabled: true,
|
||||
GroupRekey: 3600,
|
||||
DTIMMode: "default",
|
||||
No2GhzOui: true,
|
||||
MinrateNaBeaconRateKbps: 6000,
|
||||
MinrateNaDataRateKbps: 6000,
|
||||
MinrateNaMgmtRateKbps: 6000,
|
||||
MinrateNgBeaconRateKbps: 1000,
|
||||
MinrateNgCckRatesEnabled: true,
|
||||
MinrateNgDataRateKbps: 1000,
|
||||
MinrateNgMgmtRateKbps: 1000,
|
||||
}
|
||||
|
||||
resp, err := c.c.CreateWLAN(c.site, req)
|
||||
|
||||
@@ -18,7 +18,10 @@ func TestAccWLAN_basic(t *testing.T) {
|
||||
// testCheckNetworkExists(t, "name"),
|
||||
),
|
||||
},
|
||||
importStep("unifi_wlan.test", "name", "passphrase", "vlan_id", "wlan_group_id", "user_group_id"),
|
||||
importStep("unifi_wlan.test",
|
||||
"name", "passphrase", "vlan_id", "wlan_group_id",
|
||||
"user_group_id", "security",
|
||||
),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -36,5 +39,6 @@ resource "unifi_wlan" "test" {
|
||||
passphrase = "12345678"
|
||||
wlan_group_id = data.unifi_wlan_group.default.id
|
||||
user_group_id = data.unifi_user_group.default.id
|
||||
security = "wpapsk"
|
||||
}
|
||||
`
|
||||
|
||||
@@ -142,41 +142,41 @@ type WLAN struct {
|
||||
Security string `json:"security"` // "wpapsk", "wpaeap", "open"
|
||||
WPAEnc string `json:"wpa_enc"` // "ccmp", "tkip"?
|
||||
WPAMode string `json:"wpa_mode"` // "wpa2"
|
||||
XPassphrase string `json:"x_passphrase"`
|
||||
XPassphrase string `json:"x_passphrase,omitempty"`
|
||||
HideSSID bool `json:"hide_ssid"`
|
||||
IsGuest bool `json:"is_guest"`
|
||||
|
||||
// create only?
|
||||
FastRoamingEnabled bool `json:"fast_roaming_enabled,omitempty"`
|
||||
HideSSID bool `json:"hide_ssid,omitempty"`
|
||||
IsGuest bool `json:"is_guest,omitempty"`
|
||||
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled,omitempty"`
|
||||
FastRoamingEnabled bool `json:"fast_roaming_enabled,omitempty"`
|
||||
|
||||
RADIUSDasEnabled bool `json:"radius_das_enabled"`
|
||||
|
||||
WLANGroupID string `json:"wlangroup_id"`
|
||||
UserGroupID string `json:"usergroup_id"`
|
||||
|
||||
NameCombineEnabled bool `json:"name_combine_enabled"`
|
||||
NameCombineSuffix string `json:"name_combine_suffix"`
|
||||
NameCombineSuffix string `json:"name_combine_suffix,omitempty"`
|
||||
|
||||
XIappKey string `json:"x_iapp_key,omitempty"`
|
||||
|
||||
No2GhzOui bool `json:"no2ghz_oui"`
|
||||
WEPIdx int `json:"wep_idx,omitempty"`
|
||||
UserGroupID string `json:"usergroup_id"`
|
||||
DTIMMode string `json:"dtim_mode"`
|
||||
DTIMNg int `json:"dtim_ng,omitempty"`
|
||||
DTIMNa int `json:"dtim_na,omitempty"`
|
||||
No2GhzOui bool `json:"no2ghz_oui"`
|
||||
WEPIdx int `json:"wep_idx,omitempty"`
|
||||
DTIMMode string `json:"dtim_mode"`
|
||||
DTIMNg int `json:"dtim_ng,omitempty"`
|
||||
DTIMNa int `json:"dtim_na,omitempty"`
|
||||
|
||||
MinrateNgEnabled bool `json:"minrate_ng_enabled"`
|
||||
MinrateNgBeaconRateKbps int `json:"minrate_ng_beacon_rate_kbps"`
|
||||
MinrateNgDataRateKbps int `json:"minrate_ng_data_rate_kbps"`
|
||||
MinrateNgBeaconRateKbps int `json:"minrate_ng_beacon_rate_kbps,omitempty"`
|
||||
MinrateNgDataRateKbps int `json:"minrate_ng_data_rate_kbps,omitempty"`
|
||||
MinrateNgAdvertisingRates bool `json:"minrate_ng_advertising_rates"`
|
||||
MinrateNgCckRatesEnabled bool `json:"minrate_ng_cck_rates_enabled"`
|
||||
MinrateNaEnabled bool `json:"minrate_na_enabled"`
|
||||
MinrateNaAdvertisingRates bool `json:"minrate_na_advertising_rates"`
|
||||
MinrateNaDataRateKbps int `json:"minrate_na_data_rate_kbps"`
|
||||
MinrateNgMgmtRateKbps int `json:"minrate_ng_mgmt_rate_kbps"`
|
||||
MinrateNaMgmtRateKbps int `json:"minrate_na_mgmt_rate_kbps"`
|
||||
MinrateNaBeaconRateKbps int `json:"minrate_na_beacon_rate_kbps"`
|
||||
MinrateNaDataRateKbps int `json:"minrate_na_data_rate_kbps,omitempty"`
|
||||
MinrateNgMgmtRateKbps int `json:"minrate_ng_mgmt_rate_kbps,omitempty"`
|
||||
MinrateNaMgmtRateKbps int `json:"minrate_na_mgmt_rate_kbps,omitempty"`
|
||||
MinrateNaBeaconRateKbps int `json:"minrate_na_beacon_rate_kbps,omitempty"`
|
||||
|
||||
MACFilterEnabled bool `json:"mac_filter_enabled"`
|
||||
MACFilterPolicy string `json:"mac_filter_policy,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user