diff --git a/docs/data-sources/equinix_network_device.md b/docs/data-sources/equinix_network_device.md index 5f3f4fd5f..e359ae7db 100644 --- a/docs/data-sources/equinix_network_device.md +++ b/docs/data-sources/equinix_network_device.md @@ -49,6 +49,7 @@ NOTE: Exactly one of either `uuid` or `name` must be specified. * APPLIED * WAITING_FOR_CLUSTER_SETUP * REGISTRATION_FAILED + * NA * `license_file_id` - Unique identifier of applied license file * `ibx` - Device location Equinix Business Exchange name * `region` - Device location region @@ -71,3 +72,4 @@ primary or secondary * `zone_code` - Device location zone code * `cluster_id` - The id of the cluster * `num_of_nodes` - The number of nodes in the cluster +* `connectivity` - Device accessibility (INTERNET-ACCESS or PRIVATE or INTERNET-ACCESS-WITH-PRVT-MGMT) \ No newline at end of file diff --git a/docs/resources/equinix_network_device.md b/docs/resources/equinix_network_device.md index ec5353f00..f3ccb529e 100644 --- a/docs/resources/equinix_network_device.md +++ b/docs/resources/equinix_network_device.md @@ -43,6 +43,7 @@ resource "equinix_network_device" "csr1000v-ha" { metro_code = data.equinix_network_account.dc.metro_code type_code = "CSR1000V" self_managed = false + connectivity = "INTERNET-ACCESS" byol = false package_code = "SEC" notifications = ["john@equinix.com", "marry@equinix.com", "fred@equinix.com"] @@ -190,6 +191,7 @@ resource "equinix_network_device" "arista-ha" { metro_code = data.equinix_network_account.sv.metro_code type_code = "ARISTA-ROUTER" self_managed = true + connectivity = "PRIVATE" byol = true package_code = "CloudEOS" notifications = ["test@equinix.com"] @@ -261,6 +263,8 @@ on a device (max one key). See [SSH Key](#ssh-key) below for more details. device configurations. See [Secondary Device](#secondary-device) below for more details. * `cluster_details` - (Optional) An object that has the cluster details. See [Cluster Details](#cluster-details) below for more details. +* `connectivity` - (Optional) Device accessibility (INTERNET-ACCESS or PRIVATE or INTERNET-ACCESS-WITH-PRVT-MGMT). +If not specified, default will be INTERNET-ACCESS ### Secondary Device diff --git a/equinix/data_source_network_device.go b/equinix/data_source_network_device.go index 3289c3b89..8d4b7fa45 100644 --- a/equinix/data_source_network_device.go +++ b/equinix/data_source_network_device.go @@ -275,6 +275,11 @@ func createDataSourceNetworkDeviceSchema() map[string]*schema.Schema { Computed: true, Description: neDeviceDescriptions["ZoneCode"], }, + neDeviceSchemaNames["Connectivity"]: { + Type: schema.TypeString, + Computed: true, + Description: neDeviceDescriptions["Connectivity"], + }, neDeviceSchemaNames["Secondary"]: { Type: schema.TypeList, Computed: true, diff --git a/equinix/resource_network_device.go b/equinix/resource_network_device.go index 3bf968700..bdefb4b56 100644 --- a/equinix/resource_network_device.go +++ b/equinix/resource_network_device.go @@ -60,6 +60,7 @@ var neDeviceSchemaNames = map[string]string{ "Secondary": "secondary_device", "ClusterDetails": "cluster_details", "ValidStatusList": "valid_status_list", + "Connectivity": "connectivity", } var neDeviceDescriptions = map[string]string{ @@ -105,6 +106,7 @@ var neDeviceDescriptions = map[string]string{ "Secondary": "Definition of secondary device applicable for HA setup", "ClusterDetails": "An object that has the cluster details", "ValidStatusList": "Comma Separated List of states to be considered valid when searching by name", + "Connectivity": "Parameter to identify internet access for device. Supported Values: INTERNET-ACCESS(default) or PRIVATE or INTERNET-ACCESS-WITH-PRVT-MGMT", } var neDeviceInterfaceSchemaNames = map[string]string{ @@ -479,6 +481,14 @@ func createNetworkDeviceSchema() map[string]*schema.Schema { Computed: true, Description: neDeviceDescriptions["ZoneCode"], }, + neDeviceSchemaNames["Connectivity"]: { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: "INTERNET-ACCESS", + ValidateFunc: validation.StringInSlice([]string{"INTERNET-ACCESS", "PRIVATE", "INTERNET-ACCESS-WITH-PRVT-MGMT"}, false), + Description: neDeviceDescriptions["Connectivity"], + }, neDeviceSchemaNames["Secondary"]: { Type: schema.TypeList, Optional: true, @@ -1100,6 +1110,9 @@ func createNetworkDevices(d *schema.ResourceData) (*ne.Device, *ne.Device) { if v, ok := d.GetOk(neDeviceSchemaNames["ClusterDetails"]); ok { primary.ClusterDetails = expandNetworkDeviceClusterDetails(v.([]interface{})) } + if v, ok := d.GetOk(neDeviceSchemaNames["Connectivity"]); ok { + primary.Connectivity = ne.String(v.(string)) + } return primary, secondary } @@ -1603,6 +1616,7 @@ func createNetworkDeviceLicenseStatusWaitConfiguration(fetchFunc getDevice, id s target := []string{ ne.DeviceLicenseStateRegistered, ne.DeviceLicenseStateApplied, + ne.DeviceLicenseStateNA, } return &retry.StateChangeConf{ Pending: pending, diff --git a/equinix/resource_network_device_acc_test.go b/equinix/resource_network_device_acc_test.go index 12dce78ba..5f4bc3100 100644 --- a/equinix/resource_network_device_acc_test.go +++ b/equinix/resource_network_device_acc_test.go @@ -542,6 +542,7 @@ func TestAccNetworkDevice_PaloAlto_HA_Self_BYOL(t *testing.T) { "device-resourceName": "test", "device-account_name": accountName.(string), "device-self_managed": true, + "connectivity": "PRIVATE", "device-byol": true, "device-name": fmt.Sprintf("%s-%s", tstResourcePrefix, randString(6)), "device-metro_code": metro.(string), @@ -1034,6 +1035,9 @@ func testAccNeDeviceAttributes(device *ne.Device, ctx map[string]interface{}) re if v, ok := ctx["device-vendorConfig_serialNumber"]; ok && device.VendorConfiguration["serialNumber"] != v.(string) { return fmt.Errorf("device-vendorConfig_serialNumber does not match %v - %v", device.VendorConfiguration["serialNumber"], v) } + if v, ok := ctx["connectivity"]; ok && ne.StringValue(device.Connectivity) != v.(string) { + return fmt.Errorf("connectivity does not match %v - %v", ne.StringValue(device.Connectivity), v) + } return nil } } diff --git a/equinix/resource_network_device_test.go b/equinix/resource_network_device_test.go index 9aa06c5bc..60db2674a 100644 --- a/equinix/resource_network_device_test.go +++ b/equinix/resource_network_device_test.go @@ -46,6 +46,7 @@ func TestNetworkDevice_createFromResourceData(t *testing.T) { IsSelfManaged: ne.Bool(false), VendorConfiguration: expectedPrimaryVendorConfig, UserPublicKey: &expectedPrimaryUserKey, + Connectivity: ne.String("INTERNET-ACCESS"), } rawData := map[string]interface{}{ neDeviceSchemaNames["Name"]: ne.StringValue(expectedPrimary.Name), diff --git a/go.mod b/go.mod index 9880ce6ab..69adb7865 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/equinix-labs/fabric-go v0.4.0 github.com/equinix-labs/metal-go v0.16.0 github.com/equinix/ecx-go/v2 v2.3.1 - github.com/equinix/ne-go v1.10.0 + github.com/equinix/ne-go v1.11.0 github.com/equinix/oauth2-go v1.0.0 github.com/equinix/rest-go v1.3.0 github.com/gruntwork-io/terratest v0.43.0 diff --git a/go.sum b/go.sum index 9a62ebee7..f8e303652 100644 --- a/go.sum +++ b/go.sum @@ -264,8 +264,8 @@ github.com/equinix-labs/metal-go v0.16.0 h1:4YmGx9SRFkDtHiEqRsSjlgJDztV6NHqH1eea github.com/equinix-labs/metal-go v0.16.0/go.mod h1:SmxCklxW+KjmBLVMdEXgtFO5gD5/b4N0VxcNgUYbOH4= github.com/equinix/ecx-go/v2 v2.3.1 h1:gFcAIeyaEUw7S8ebqApmT7E/S7pC7Ac3wgScp89fkPU= github.com/equinix/ecx-go/v2 v2.3.1/go.mod h1:FvCdZ3jXU8Z4CPKig2DT+4J2HdwgRK17pIcznM7RXyk= -github.com/equinix/ne-go v1.10.0 h1:hy1umXQFPi1b3z/maZ8kqLRFlD1PXD4qp0cV8rnyL8k= -github.com/equinix/ne-go v1.10.0/go.mod h1:eHkkxM4nbTB7DZ9X9zGnwfYnxIJWIsU3aHA+FAoZ1EI= +github.com/equinix/ne-go v1.11.0 h1:ja6G2fmcGrLsOeV25Mq6pDfH+/cUlvxJbnE8uRXTGGk= +github.com/equinix/ne-go v1.11.0/go.mod h1:eHkkxM4nbTB7DZ9X9zGnwfYnxIJWIsU3aHA+FAoZ1EI= github.com/equinix/oauth2-go v1.0.0 h1:fHtAPGq82PdgtK5vEThs8Vwz6f7D/8SX4tE3NJu+KcU= github.com/equinix/oauth2-go v1.0.0/go.mod h1:4pulXvUNMktJlewLPnUeJyMW52iCoF1aM+A/Z5xY1ws= github.com/equinix/rest-go v1.3.0 h1:m38scYTOfV6N+gcrwchgVDutDffYd+QoYCMm9Jn6jyk=