diff --git a/docs/data-sources/network_device.md b/docs/data-sources/network_device.md index 0bb9e3a87..21e5028d3 100644 --- a/docs/data-sources/network_device.md +++ b/docs/data-sources/network_device.md @@ -76,3 +76,4 @@ NOTE: Exactly one of either `uuid` or `name` must be specified. * `connectivity` - Device accessibility (INTERNET-ACCESS or PRIVATE or INTERNET-ACCESS-WITH-PRVT-MGMT) * `diverse_device_id` - diverse device uuid * `diverse_device_name` - Name of the device with diverse device UUID +* `tier` - Throughput Tier (applicable for C8000V, C8000V-SDWAN devices) diff --git a/docs/resources/network_device.md b/docs/resources/network_device.md index 3e9d2ad45..ebaea2d34 100644 --- a/docs/resources/network_device.md +++ b/docs/resources/network_device.md @@ -397,6 +397,65 @@ resource "equinix_network_device" "panw-cluster" { } ``` +```terraform +# Create C8000V BYOL device with bandwidth tier information + +data "equinix_network_account" "sv" { + metro_code = "SV" +} + +resource "equinix_network_device" "c8000v-byol-tier" { + name = "tf-c8000v-byol" + metro_code = data.equinix_network_account.sv.metro_code + type_code = "C8000V" + self_managed = true + byol = true + package_code = "VM100" + notifications = ["john@equinix.com", "marry@equinix.com", "fred@equinix.com"] + term_length = 12 + account_number = data.equinix_network_account.sv.number + version = "17.11.01a" + interface_count = 10 + core_count = 2 + tier = 1 + ssh_key { + username = "test" + key_name = "test-key" + } + acl_template_id = "0bff6e05-f0e7-44cd-804a-25b92b835f8b" +} +``` + +```terraform +# Create C8000V BYOL device with numeric bandwidth throughput information + +data "equinix_network_account" "sv" { + metro_code = "SV" +} + +resource "equinix_network_device" "c8000v-byol-throughput" { + name = "tf-c8000v-byol" + metro_code = data.equinix_network_account.sv.metro_code + type_code = "C8000V" + self_managed = true + byol = true + package_code = "VM100" + notifications = ["john@equinix.com", "marry@equinix.com", "fred@equinix.com"] + term_length = 12 + account_number = data.equinix_network_account.sv.number + version = "17.11.01a" + interface_count = 10 + core_count = 2 + throughput = "100" + throughput_unit = "Mbps" + ssh_key { + username = "test" + key_name = "test-key" + } + acl_template_id = "0bff6e05-f0e7-44cd-804a-25b92b835f8b" +} +``` + ```terraform # Create self configured single Aviatrix Transit Edge device with cloud init file @@ -444,6 +503,7 @@ The following arguments are supported: * `package_code` - (Required) Device software package code. * `version` - (Required) Device software software version. * `core_count` - (Required) Number of CPU cores used by device. (**NOTE: Use this field to resize your device. When resizing your HA devices, primary device will be upgraded first. If the upgrade failed, device will be automatically rolled back to the previous state with original core number.**) +* `tier` - (Optional, conflicts with `throughput`,`throughput_unit` ) Select bandwidth tier for your own license, i.e., `0` or `1` or `2` or `3`. Tiers applicable only for C8000V Autonomous or C8000V SDWAN (controller) device types. If not provided, tier is defaulted to '2'. * `term_length` - (Required) Device term length. * `self_managed` - (Optional) Boolean value that determines device management mode, i.e., `self-managed` or `Equinix-managed` (default). * `byol` - (Optional) Boolean value that determines device licensing mode, i.e., `bring your own license` or `subscription` (default). diff --git a/equinix/data_source_network_device.go b/equinix/data_source_network_device.go index 3e8e220b9..22d455a4a 100644 --- a/equinix/data_source_network_device.go +++ b/equinix/data_source_network_device.go @@ -295,6 +295,11 @@ func createDataSourceNetworkDeviceSchema() map[string]*schema.Schema { Computed: true, Description: neDeviceDescriptions["DiverseFromDeviceUUID"], }, + neDeviceSchemaNames["Tier"]: { + Type: schema.TypeInt, + Computed: true, + Description: neDeviceDescriptions["Tier"], + }, neDeviceSchemaNames["DiverseFromDeviceName"]: { Type: schema.TypeString, Computed: true, @@ -853,6 +858,9 @@ func updateDataSourceNetworkDeviceResource(primary *ne.Device, secondary *ne.Dev if err := d.Set(neDeviceSchemaNames["DiverseFromDeviceUUID"], primary.DiverseFromDeviceUUID); err != nil { return fmt.Errorf("error reading DiverseFromDeviceUUID: %s", err) } + if err := d.Set(neDeviceSchemaNames["Tier"], primary.Tier); err != nil { + return fmt.Errorf("error reading Tier: %s", err) + } if err := d.Set(neDeviceSchemaNames["DiverseFromDeviceName"], primary.DiverseFromDeviceName); err != nil { return fmt.Errorf("error reading DiverseFromDeviceName: %s", err) } diff --git a/equinix/resource_network_device.go b/equinix/resource_network_device.go index 813202dfb..87ed33fe7 100644 --- a/equinix/resource_network_device.go +++ b/equinix/resource_network_device.go @@ -70,6 +70,7 @@ var neDeviceSchemaNames = map[string]string{ "Connectivity": "connectivity", "DiverseFromDeviceUUID": "diverse_device_id", "DiverseFromDeviceName": "diverse_device_name", + "Tier": "tier", } var neDeviceDescriptions = map[string]string{ @@ -119,6 +120,7 @@ var neDeviceDescriptions = map[string]string{ "ProjectID": "The unique identifier of Project Resource to which device is scoped to", "DiverseFromDeviceUUID": "Unique ID of an existing device", "DiverseFromDeviceName": "Diverse Device Name of an existing device", + "Tier": "Bandwidth Tiers", } var neDeviceInterfaceSchemaNames = map[string]string{ @@ -439,6 +441,15 @@ func createNetworkDeviceSchema() map[string]*schema.Schema { ConflictsWith: []string{neDeviceSchemaNames["Secondary"]}, Description: neDeviceDescriptions["DiverseFromDeviceUUID"], }, + neDeviceSchemaNames["Tier"]: { + Type: schema.TypeInt, + ForceNew: true, + Computed: true, + Optional: true, + ValidateFunc: validation.IntInSlice([]int{0, 1, 2, 3}), + ConflictsWith: []string{neDeviceSchemaNames["Throughput"], neDeviceSchemaNames["ThroughputUnit"]}, + Description: neDeviceDescriptions["Tier"], + }, neDeviceSchemaNames["DiverseFromDeviceName"]: { Type: schema.TypeString, Computed: true, @@ -1137,6 +1148,9 @@ func createNetworkDevices(d *schema.ResourceData) (*ne.Device, *ne.Device) { if v, ok := d.GetOk(neDeviceSchemaNames["ProjectID"]); ok { primary.ProjectID = ne.String(v.(string)) } + if v, ok := d.GetOk(neDeviceSchemaNames["Tier"]); ok { + primary.Tier = ne.Int(v.(int)) + } if v, ok := d.GetOk(neDeviceSchemaNames["DiverseFromDeviceUUID"]); ok { primary.DiverseFromDeviceUUID = ne.String(v.(string)) } @@ -1231,6 +1245,9 @@ func updateNetworkDeviceResource(primary *ne.Device, secondary *ne.Device, d *sc if err := d.Set(neDeviceSchemaNames["Name"], primary.Name); err != nil { return fmt.Errorf("error reading Name: %s", err) } + if err := d.Set(neDeviceSchemaNames["Tier"], primary.Tier); err != nil { + return fmt.Errorf("error reading Tier: %s", err) + } if err := d.Set(neDeviceSchemaNames["ProjectID"], primary.ProjectID); err != nil { return fmt.Errorf("error reading ProjectID: %s", err) } @@ -1406,6 +1423,9 @@ func expandNetworkDeviceSecondary(devices []interface{}) *ne.Device { if v, ok := device[neDeviceSchemaNames["Name"]]; ok && !isEmpty(v) { transformed.Name = ne.String(v.(string)) } + if v, ok := device[neDeviceSchemaNames["Tier"]]; ok && !isEmpty(v) { + transformed.Tier = ne.Int(v.(int)) + } if v, ok := device[neDeviceSchemaNames["ProjectID"]]; ok && !isEmpty(v) { transformed.ProjectID = ne.String(v.(string)) } diff --git a/examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_throughput.tf b/examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_throughput.tf new file mode 100644 index 000000000..8ccce6b0d --- /dev/null +++ b/examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_throughput.tf @@ -0,0 +1,27 @@ +# Create C8000V BYOL device with numeric bandwidth throughput information + +data "equinix_network_account" "sv" { + metro_code = "SV" +} + +resource "equinix_network_device" "c8000v-byol-throughput" { + name = "tf-c8000v-byol" + metro_code = data.equinix_network_account.sv.metro_code + type_code = "C8000V" + self_managed = true + byol = true + package_code = "VM100" + notifications = ["john@equinix.com", "marry@equinix.com", "fred@equinix.com"] + term_length = 12 + account_number = data.equinix_network_account.sv.number + version = "17.11.01a" + interface_count = 10 + core_count = 2 + throughput = "100" + throughput_unit = "Mbps" + ssh_key { + username = "test" + key_name = "test-key" + } + acl_template_id = "0bff6e05-f0e7-44cd-804a-25b92b835f8b" +} \ No newline at end of file diff --git a/examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_tier.tf b/examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_tier.tf new file mode 100644 index 000000000..eddcf1039 --- /dev/null +++ b/examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_tier.tf @@ -0,0 +1,26 @@ +# Create C8000V BYOL device with bandwidth tier information + +data "equinix_network_account" "sv" { + metro_code = "SV" +} + +resource "equinix_network_device" "c8000v-byol-tier" { + name = "tf-c8000v-byol" + metro_code = data.equinix_network_account.sv.metro_code + type_code = "C8000V" + self_managed = true + byol = true + package_code = "VM100" + notifications = ["john@equinix.com", "marry@equinix.com", "fred@equinix.com"] + term_length = 12 + account_number = data.equinix_network_account.sv.number + version = "17.11.01a" + interface_count = 10 + core_count = 2 + tier = 1 + ssh_key { + username = "test" + key_name = "test-key" + } + acl_template_id = "0bff6e05-f0e7-44cd-804a-25b92b835f8b" +} \ No newline at end of file diff --git a/go.mod b/go.mod index 45f5af140..99eb76abc 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.22 require ( github.com/equinix/equinix-sdk-go v0.46.0 - github.com/equinix/ne-go v1.17.0 + github.com/equinix/ne-go v1.18.0 github.com/equinix/oauth2-go v1.0.0 github.com/equinix/rest-go v1.3.0 github.com/google/uuid v1.6.0 diff --git a/go.sum b/go.sum index 384ca31c6..9ebfb0925 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,8 @@ github.com/equinix/equinix-sdk-go v0.46.0 h1:ldQo4GtXNr+0XsThQJf/pUdx5wcLFe9QpLF github.com/equinix/equinix-sdk-go v0.46.0/go.mod h1:hEb3XLaedz7xhl/dpPIS6eOIiXNPeqNiVoyDrT6paIg= github.com/equinix/ne-go v1.17.0 h1:+wZq0GNognpiTHTsBXtATOCphTFvnowF046NzQXj0n0= github.com/equinix/ne-go v1.17.0/go.mod h1:eHkkxM4nbTB7DZ9X9zGnwfYnxIJWIsU3aHA+FAoZ1EI= +github.com/equinix/ne-go v1.18.0 h1:5az4ai39y1XLNOq3+qQVT9wFG7BmaQfj941MNqqouhk= +github.com/equinix/ne-go v1.18.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= diff --git a/templates/data-sources/network_device.md.tmpl b/templates/data-sources/network_device.md.tmpl index 47a4f8330..3d5e9f753 100644 --- a/templates/data-sources/network_device.md.tmpl +++ b/templates/data-sources/network_device.md.tmpl @@ -70,3 +70,4 @@ NOTE: Exactly one of either `uuid` or `name` must be specified. * `connectivity` - Device accessibility (INTERNET-ACCESS or PRIVATE or INTERNET-ACCESS-WITH-PRVT-MGMT) * `diverse_device_id` - diverse device uuid * `diverse_device_name` - Name of the device with diverse device UUID +* `tier` - Throughput Tier (applicable for C8000V, C8000V-SDWAN devices) diff --git a/templates/resources/network_device.md.tmpl b/templates/resources/network_device.md.tmpl index bce28fa68..cd8bc862e 100644 --- a/templates/resources/network_device.md.tmpl +++ b/templates/resources/network_device.md.tmpl @@ -40,6 +40,10 @@ In addition to management modes, there are two software license modes available: {{tffile "examples/resources/equinix_network_device/example_9.tf"}} +{{tffile "examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_tier.tf"}} + +{{tffile "examples/resources/equinix_network_device/c8000v_byol_with_bandwidth_throughput.tf"}} + {{tffile "examples/resources/equinix_network_device/Aviatrix_Transit_Edge.tf"}} ## Argument Reference @@ -53,6 +57,7 @@ The following arguments are supported: * `package_code` - (Required) Device software package code. * `version` - (Required) Device software software version. * `core_count` - (Required) Number of CPU cores used by device. (**NOTE: Use this field to resize your device. When resizing your HA devices, primary device will be upgraded first. If the upgrade failed, device will be automatically rolled back to the previous state with original core number.**) +* `tier` - (Optional, conflicts with `throughput`,`throughput_unit` ) Select bandwidth tier for your own license, i.e., `0` or `1` or `2` or `3`. Tiers applicable only for C8000V Autonomous or C8000V SDWAN (controller) device types. If not provided, tier is defaulted to '2'. * `term_length` - (Required) Device term length. * `self_managed` - (Optional) Boolean value that determines device management mode, i.e., `self-managed` or `Equinix-managed` (default). * `byol` - (Optional) Boolean value that determines device licensing mode, i.e., `bring your own license` or `subscription` (default).