diff --git a/docs/resources/network_device.md b/docs/resources/network_device.md index f00f40638..5a8f33df6 100644 --- a/docs/resources/network_device.md +++ b/docs/resources/network_device.md @@ -552,6 +552,36 @@ resource "equinix_network_device" "zscaler-pse-single" { } ``` +```terraform +# Create C8000V BYOL device with bandwidth tier information + +data "equinix_network_account" "sv" { + metro_code = "SV" +} + +resource "equinix_network_device" "c8000v-byol-withtout-default-password" { + name = "tf-c8000v-byol" + metro_code = data.equinix_network_account.sv.metro_code + type_code = "C8000V" + self_managed = true + byol = true + generate_default_password = false + 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" +} +``` + ## Argument Reference The following arguments are supported: @@ -589,6 +619,9 @@ The following arguments are supported: * `connectivity` - (Optional) Device accessibility (INTERNET-ACCESS or PRIVATE or INTERNET-ACCESS-WITH-PRVT-MGMT). If not specified, default will be INTERNET-ACCESS * `project_id` - (Optional) Unique Identifier for the project resource where the device is scoped to.If you leave it out, the device will be created under the default project id of your organization. * `diverse_device_id` - (Optional) Unique ID of an existing device. Use this field to let Equinix know if you want your new device to be in a different location from any existing virtual device. This field is only meaningful for single devices. +* `generate_default_password` - (Optional) Boolean value that determines to create device with or without default password. Use this field to let Equinix know if you want your new device to be create with default admin password. +This field is only meaningful for C8000V Autonomous(single/ha) and Fortinet Firewall devices(single/ha/cluster). If not specified, by default device is created with admin password. + ### Secondary Device diff --git a/equinix/resource_network_device.go b/equinix/resource_network_device.go index 87ed33fe7..811dd78d7 100644 --- a/equinix/resource_network_device.go +++ b/equinix/resource_network_device.go @@ -24,103 +24,105 @@ import ( ) var neDeviceSchemaNames = map[string]string{ - "UUID": "uuid", - "Name": "name", - "TypeCode": "type_code", - "Status": "status", - "MetroCode": "metro_code", - "IBX": "ibx", - "Region": "region", - "Throughput": "throughput", - "ThroughputUnit": "throughput_unit", - "HostName": "hostname", - "PackageCode": "package_code", - "Version": "version", - "IsBYOL": "byol", - "LicenseToken": "license_token", - "LicenseFile": "license_file", - "LicenseFileID": "license_file_id", - "CloudInitFileID": "cloud_init_file_id", - "LicenseStatus": "license_status", - "ACLTemplateUUID": "acl_template_id", - "MgmtAclTemplateUuid": "mgmt_acl_template_uuid", - "SSHIPAddress": "ssh_ip_address", - "SSHIPFqdn": "ssh_ip_fqdn", - "AccountNumber": "account_number", - "Notifications": "notifications", - "PurchaseOrderNumber": "purchase_order_number", - "RedundancyType": "redundancy_type", - "RedundantUUID": "redundant_id", - "ProjectID": "project_id", - "TermLength": "term_length", - "AdditionalBandwidth": "additional_bandwidth", - "OrderReference": "order_reference", - "InterfaceCount": "interface_count", - "CoreCount": "core_count", - "IsSelfManaged": "self_managed", - "WanInterfaceId": "wan_interface_id", - "Interfaces": "interface", - "VendorConfiguration": "vendor_configuration", - "UserPublicKey": "ssh_key", - "ASN": "asn", - "ZoneCode": "zone_code", - "Secondary": "secondary_device", - "ClusterDetails": "cluster_details", - "ValidStatusList": "valid_status_list", - "Connectivity": "connectivity", - "DiverseFromDeviceUUID": "diverse_device_id", - "DiverseFromDeviceName": "diverse_device_name", - "Tier": "tier", + "UUID": "uuid", + "Name": "name", + "TypeCode": "type_code", + "Status": "status", + "MetroCode": "metro_code", + "IBX": "ibx", + "Region": "region", + "Throughput": "throughput", + "ThroughputUnit": "throughput_unit", + "HostName": "hostname", + "PackageCode": "package_code", + "Version": "version", + "IsBYOL": "byol", + "LicenseToken": "license_token", + "LicenseFile": "license_file", + "LicenseFileID": "license_file_id", + "CloudInitFileID": "cloud_init_file_id", + "LicenseStatus": "license_status", + "ACLTemplateUUID": "acl_template_id", + "MgmtAclTemplateUuid": "mgmt_acl_template_uuid", + "SSHIPAddress": "ssh_ip_address", + "SSHIPFqdn": "ssh_ip_fqdn", + "AccountNumber": "account_number", + "Notifications": "notifications", + "PurchaseOrderNumber": "purchase_order_number", + "RedundancyType": "redundancy_type", + "RedundantUUID": "redundant_id", + "ProjectID": "project_id", + "TermLength": "term_length", + "AdditionalBandwidth": "additional_bandwidth", + "OrderReference": "order_reference", + "InterfaceCount": "interface_count", + "CoreCount": "core_count", + "IsSelfManaged": "self_managed", + "WanInterfaceId": "wan_interface_id", + "Interfaces": "interface", + "VendorConfiguration": "vendor_configuration", + "UserPublicKey": "ssh_key", + "ASN": "asn", + "ZoneCode": "zone_code", + "Secondary": "secondary_device", + "ClusterDetails": "cluster_details", + "ValidStatusList": "valid_status_list", + "Connectivity": "connectivity", + "DiverseFromDeviceUUID": "diverse_device_id", + "DiverseFromDeviceName": "diverse_device_name", + "IsGenerateDefaultPassword": "generate_default_password", + "Tier": "tier", } var neDeviceDescriptions = map[string]string{ - "UUID": "Device unique identifier", - "Name": "Device name", - "TypeCode": "Device type code", - "Status": "Device provisioning status", - "MetroCode": "Device location metro code", - "IBX": "Device location Equinix Business Exchange name", - "Region": "Device location region", - "Throughput": "Device license throughput", - "ThroughputUnit": "Device license throughput unit (Mbps or Gbps)", - "HostName": "Device hostname prefix", - "PackageCode": "Device software package code", - "Version": "Device software software version", - "IsBYOL": "Boolean value that determines device licensing mode: bring your own license or subscription (default)", - "LicenseToken": "License Token applicable for some device types in BYOL licensing mode", - "LicenseFile": "Path to the license file that will be uploaded and applied on a device, applicable for some device types in BYOL licensing mode", - "LicenseFileID": "Unique identifier of applied license file", - "CloudInitFileID": "Unique identifier of applied cloud init file", - "LicenseStatus": "Device license registration status", - "ACLTemplateUUID": "Unique identifier of applied ACL template", - "MgmtAclTemplateUuid": "Unique identifier of applied MGMT ACL template", - "SSHIPAddress": "IP address of SSH enabled interface on the device", - "SSHIPFqdn": "FQDN of SSH enabled interface on the device", - "AccountNumber": "Device billing account number", - "Notifications": "List of email addresses that will receive device status notifications", - "PurchaseOrderNumber": "Purchase order number associated with a device order", - "RedundancyType": "Device redundancy type applicable for HA devices, either primary or secondary", - "RedundantUUID": "Unique identifier for a redundant device, applicable for HA device", - "TermLength": "Device term length", - "AdditionalBandwidth": "Additional Internet bandwidth, in Mbps, that will be allocated to the device", - "OrderReference": "Name/number used to identify device order on the invoice", - "InterfaceCount": "Number of network interfaces on a device. If not specified, default number for a given device type will be used", - "CoreCount": "Number of CPU cores used by device", - "IsSelfManaged": "Boolean value that determines device management mode: self-managed or subscription (default)", - "WanInterfaceId": "device interface id picked for WAN", - "Interfaces": "List of device interfaces", - "VendorConfiguration": "Map of vendor specific configuration parameters for a device (controller1, activationKey, managementType, siteId, systemIpAddress)", - "UserPublicKey": "Definition of SSH key that will be provisioned on a device", - "ASN": "Autonomous system number", - "ZoneCode": "Device location zone code", - "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", - "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", + "UUID": "Device unique identifier", + "Name": "Device name", + "TypeCode": "Device type code", + "Status": "Device provisioning status", + "MetroCode": "Device location metro code", + "IBX": "Device location Equinix Business Exchange name", + "Region": "Device location region", + "Throughput": "Device license throughput", + "ThroughputUnit": "Device license throughput unit (Mbps or Gbps)", + "HostName": "Device hostname prefix", + "PackageCode": "Device software package code", + "Version": "Device software software version", + "IsBYOL": "Boolean value that determines device licensing mode: bring your own license or subscription (default)", + "LicenseToken": "License Token applicable for some device types in BYOL licensing mode", + "LicenseFile": "Path to the license file that will be uploaded and applied on a device, applicable for some device types in BYOL licensing mode", + "LicenseFileID": "Unique identifier of applied license file", + "CloudInitFileID": "Unique identifier of applied cloud init file", + "LicenseStatus": "Device license registration status", + "ACLTemplateUUID": "Unique identifier of applied ACL template", + "MgmtAclTemplateUuid": "Unique identifier of applied MGMT ACL template", + "SSHIPAddress": "IP address of SSH enabled interface on the device", + "SSHIPFqdn": "FQDN of SSH enabled interface on the device", + "AccountNumber": "Device billing account number", + "Notifications": "List of email addresses that will receive device status notifications", + "PurchaseOrderNumber": "Purchase order number associated with a device order", + "RedundancyType": "Device redundancy type applicable for HA devices, either primary or secondary", + "RedundantUUID": "Unique identifier for a redundant device, applicable for HA device", + "TermLength": "Device term length", + "AdditionalBandwidth": "Additional Internet bandwidth, in Mbps, that will be allocated to the device", + "OrderReference": "Name/number used to identify device order on the invoice", + "InterfaceCount": "Number of network interfaces on a device. If not specified, default number for a given device type will be used", + "CoreCount": "Number of CPU cores used by device", + "IsSelfManaged": "Boolean value that determines device management mode: self-managed or subscription (default)", + "WanInterfaceId": "device interface id picked for WAN", + "Interfaces": "List of device interfaces", + "VendorConfiguration": "Map of vendor specific configuration parameters for a device (controller1, activationKey, managementType, siteId, systemIpAddress)", + "UserPublicKey": "Definition of SSH key that will be provisioned on a device", + "ASN": "Autonomous system number", + "ZoneCode": "Device location zone code", + "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", + "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", + "IsGenerateDefaultPassword": "Boolean value that decides to generate default admin password for devices. Default value is true if not provided.", } var neDeviceInterfaceSchemaNames = map[string]string{ @@ -332,6 +334,13 @@ func createNetworkDeviceSchema() map[string]*schema.Schema { ForceNew: true, Description: neDeviceDescriptions["IsBYOL"], }, + neDeviceSchemaNames["IsGenerateDefaultPassword"]: { + Type: schema.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + Description: neDeviceDescriptions["IsGenerateDefaultPassword"], + }, neDeviceSchemaNames["LicenseToken"]: { Type: schema.TypeString, Optional: true, @@ -1170,6 +1179,7 @@ func createNetworkDevices(d *schema.ResourceData) (*ne.Device, *ne.Device) { primary.Version = ne.String(v.(string)) } primary.IsBYOL = ne.Bool(d.Get(neDeviceSchemaNames["IsBYOL"]).(bool)) + primary.IsGenerateDefaultPassword = ne.Bool(d.Get(neDeviceSchemaNames["IsGenerateDefaultPassword"]).(bool)) if v, ok := d.GetOk(neDeviceSchemaNames["LicenseToken"]); ok { primary.LicenseToken = ne.String(v.(string)) } @@ -1293,6 +1303,9 @@ func updateNetworkDeviceResource(primary *ne.Device, secondary *ne.Device, d *sc if err := d.Set(neDeviceSchemaNames["IsBYOL"], primary.IsBYOL); err != nil { return fmt.Errorf("error reading IsBYOL: %s", err) } + if err := d.Set(neDeviceSchemaNames["IsGenerateDefaultPassword"], primary.IsGenerateDefaultPassword); err != nil { + return fmt.Errorf("error reading GenerateDefaultPassword: %s", err) + } if err := d.Set(neDeviceSchemaNames["LicenseFileID"], primary.LicenseFileID); err != nil { return fmt.Errorf("error reading LicenseFileID: %s", err) } diff --git a/equinix/resource_network_device_test.go b/equinix/resource_network_device_test.go index aefe03992..770c9f9c1 100644 --- a/equinix/resource_network_device_test.go +++ b/equinix/resource_network_device_test.go @@ -23,64 +23,66 @@ func TestNetworkDevice_createFromResourceData(t *testing.T) { "key": "value", } expectedPrimary := &ne.Device{ - Name: ne.String("device"), - TypeCode: ne.String("CSR1000V"), - MetroCode: ne.String("SV"), - Throughput: ne.Int(100), - ThroughputUnit: ne.String("Mbps"), - HostName: ne.String("test"), - PackageCode: ne.String("SEC"), - Version: ne.String("9.0.1"), - IsBYOL: ne.Bool(false), - LicenseToken: ne.String("sWf3df4gaAvbbexw45ga4f"), - LicenseFile: ne.String("/tmp/licenseFile"), - ACLTemplateUUID: ne.String("a624178c-6d59-4798-9a7f-2ddf2c7c5881"), - AccountNumber: ne.String("123456"), - Notifications: []string{"bla@bla.com"}, - PurchaseOrderNumber: ne.String("1234567890"), - TermLength: ne.Int(1), - AdditionalBandwidth: ne.Int(50), - OrderReference: ne.String("12312121sddsf1231"), - InterfaceCount: ne.Int(10), - WanInterfaceId: ne.String("5"), - CoreCount: ne.Int(2), - IsSelfManaged: ne.Bool(false), - VendorConfiguration: expectedPrimaryVendorConfig, - UserPublicKey: &expectedPrimaryUserKey, - Connectivity: ne.String("INTERNET-ACCESS"), - ProjectID: ne.String("68ccfd49-39b1-478e-957a-67c72f719d7a"), - DiverseFromDeviceUUID: ne.String("ed7891bd-15b4-4f72-ac56-d96cfdacddcc"), + Name: ne.String("device"), + TypeCode: ne.String("CSR1000V"), + MetroCode: ne.String("SV"), + Throughput: ne.Int(100), + ThroughputUnit: ne.String("Mbps"), + HostName: ne.String("test"), + PackageCode: ne.String("SEC"), + Version: ne.String("9.0.1"), + IsBYOL: ne.Bool(false), + LicenseToken: ne.String("sWf3df4gaAvbbexw45ga4f"), + LicenseFile: ne.String("/tmp/licenseFile"), + ACLTemplateUUID: ne.String("a624178c-6d59-4798-9a7f-2ddf2c7c5881"), + AccountNumber: ne.String("123456"), + Notifications: []string{"bla@bla.com"}, + PurchaseOrderNumber: ne.String("1234567890"), + TermLength: ne.Int(1), + AdditionalBandwidth: ne.Int(50), + OrderReference: ne.String("12312121sddsf1231"), + InterfaceCount: ne.Int(10), + WanInterfaceId: ne.String("5"), + CoreCount: ne.Int(2), + IsSelfManaged: ne.Bool(false), + VendorConfiguration: expectedPrimaryVendorConfig, + UserPublicKey: &expectedPrimaryUserKey, + Connectivity: ne.String("INTERNET-ACCESS"), + ProjectID: ne.String("68ccfd49-39b1-478e-957a-67c72f719d7a"), + DiverseFromDeviceUUID: ne.String("ed7891bd-15b4-4f72-ac56-d96cfdacddcc"), + IsGenerateDefaultPassword: ne.Bool(false), } rawData := map[string]interface{}{ - neDeviceSchemaNames["Name"]: ne.StringValue(expectedPrimary.Name), - neDeviceSchemaNames["TypeCode"]: ne.StringValue(expectedPrimary.TypeCode), - neDeviceSchemaNames["MetroCode"]: ne.StringValue(expectedPrimary.MetroCode), - neDeviceSchemaNames["Throughput"]: ne.IntValue(expectedPrimary.Throughput), - neDeviceSchemaNames["Throughput"]: ne.IntValue(expectedPrimary.Throughput), - neDeviceSchemaNames["ThroughputUnit"]: ne.StringValue(expectedPrimary.ThroughputUnit), - neDeviceSchemaNames["HostName"]: ne.StringValue(expectedPrimary.HostName), - neDeviceSchemaNames["PackageCode"]: ne.StringValue(expectedPrimary.PackageCode), - neDeviceSchemaNames["Version"]: ne.StringValue(expectedPrimary.Version), - neDeviceSchemaNames["IsBYOL"]: ne.BoolValue(expectedPrimary.IsBYOL), - neDeviceSchemaNames["LicenseToken"]: ne.StringValue(expectedPrimary.LicenseToken), - neDeviceSchemaNames["LicenseFile"]: ne.StringValue(expectedPrimary.LicenseFile), - neDeviceSchemaNames["ACLTemplateUUID"]: ne.StringValue(expectedPrimary.ACLTemplateUUID), - neDeviceSchemaNames["AccountNumber"]: ne.StringValue(expectedPrimary.AccountNumber), - neDeviceSchemaNames["PurchaseOrderNumber"]: ne.StringValue(expectedPrimary.PurchaseOrderNumber), - neDeviceSchemaNames["TermLength"]: ne.IntValue(expectedPrimary.TermLength), - neDeviceSchemaNames["AdditionalBandwidth"]: ne.IntValue(expectedPrimary.AdditionalBandwidth), - neDeviceSchemaNames["OrderReference"]: ne.StringValue(expectedPrimary.OrderReference), - neDeviceSchemaNames["InterfaceCount"]: ne.IntValue(expectedPrimary.InterfaceCount), - neDeviceSchemaNames["WanInterfaceId"]: ne.StringValue(expectedPrimary.WanInterfaceId), - neDeviceSchemaNames["CoreCount"]: ne.IntValue(expectedPrimary.CoreCount), - neDeviceSchemaNames["IsSelfManaged"]: ne.BoolValue(expectedPrimary.IsSelfManaged), - neDeviceSchemaNames["ProjectID"]: ne.StringValue(expectedPrimary.ProjectID), - neDeviceSchemaNames["DiverseFromDeviceUUID"]: ne.StringValue(expectedPrimary.DiverseFromDeviceUUID), + neDeviceSchemaNames["Name"]: ne.StringValue(expectedPrimary.Name), + neDeviceSchemaNames["TypeCode"]: ne.StringValue(expectedPrimary.TypeCode), + neDeviceSchemaNames["MetroCode"]: ne.StringValue(expectedPrimary.MetroCode), + neDeviceSchemaNames["Throughput"]: ne.IntValue(expectedPrimary.Throughput), + neDeviceSchemaNames["Throughput"]: ne.IntValue(expectedPrimary.Throughput), + neDeviceSchemaNames["ThroughputUnit"]: ne.StringValue(expectedPrimary.ThroughputUnit), + neDeviceSchemaNames["HostName"]: ne.StringValue(expectedPrimary.HostName), + neDeviceSchemaNames["PackageCode"]: ne.StringValue(expectedPrimary.PackageCode), + neDeviceSchemaNames["Version"]: ne.StringValue(expectedPrimary.Version), + neDeviceSchemaNames["IsBYOL"]: ne.BoolValue(expectedPrimary.IsBYOL), + neDeviceSchemaNames["LicenseToken"]: ne.StringValue(expectedPrimary.LicenseToken), + neDeviceSchemaNames["LicenseFile"]: ne.StringValue(expectedPrimary.LicenseFile), + neDeviceSchemaNames["ACLTemplateUUID"]: ne.StringValue(expectedPrimary.ACLTemplateUUID), + neDeviceSchemaNames["AccountNumber"]: ne.StringValue(expectedPrimary.AccountNumber), + neDeviceSchemaNames["PurchaseOrderNumber"]: ne.StringValue(expectedPrimary.PurchaseOrderNumber), + neDeviceSchemaNames["TermLength"]: ne.IntValue(expectedPrimary.TermLength), + neDeviceSchemaNames["AdditionalBandwidth"]: ne.IntValue(expectedPrimary.AdditionalBandwidth), + neDeviceSchemaNames["OrderReference"]: ne.StringValue(expectedPrimary.OrderReference), + neDeviceSchemaNames["InterfaceCount"]: ne.IntValue(expectedPrimary.InterfaceCount), + neDeviceSchemaNames["WanInterfaceId"]: ne.StringValue(expectedPrimary.WanInterfaceId), + neDeviceSchemaNames["CoreCount"]: ne.IntValue(expectedPrimary.CoreCount), + neDeviceSchemaNames["IsSelfManaged"]: ne.BoolValue(expectedPrimary.IsSelfManaged), + neDeviceSchemaNames["ProjectID"]: ne.StringValue(expectedPrimary.ProjectID), + neDeviceSchemaNames["DiverseFromDeviceUUID"]: ne.StringValue(expectedPrimary.DiverseFromDeviceUUID), + neDeviceSchemaNames["IsGenerateDefaultPassword"]: ne.BoolValue(expectedPrimary.IsGenerateDefaultPassword), } d := schema.TestResourceDataRaw(t, createNetworkDeviceSchema(), rawData) - d.Set(neDeviceSchemaNames["Notifications"], expectedPrimary.Notifications) - d.Set(neDeviceSchemaNames["UserPublicKey"], flattenNetworkDeviceUserKeys([]*ne.DeviceUserPublicKey{&expectedPrimaryUserKey})) - d.Set(neDeviceSchemaNames["VendorConfiguration"], expectedPrimary.VendorConfiguration) + _ = d.Set(neDeviceSchemaNames["Notifications"], expectedPrimary.Notifications) + _ = d.Set(neDeviceSchemaNames["UserPublicKey"], flattenNetworkDeviceUserKeys([]*ne.DeviceUserPublicKey{&expectedPrimaryUserKey})) + _ = d.Set(neDeviceSchemaNames["VendorConfiguration"], expectedPrimary.VendorConfiguration) // when primary, secondary := createNetworkDevices(d) @@ -94,30 +96,31 @@ func TestNetworkDevice_createFromResourceData(t *testing.T) { func TestNetworkDevice_updateResourceData(t *testing.T) { // given inputPrimary := &ne.Device{ - Name: ne.String("device"), - TypeCode: ne.String("CSR1000V"), - ProjectID: ne.String("68ccfd49-39b1-478e-957a-67c72f719d7a"), - MetroCode: ne.String("SV"), - Throughput: ne.Int(100), - ThroughputUnit: ne.String("Mbps"), - HostName: ne.String("test"), - PackageCode: ne.String("SEC"), - Version: ne.String("9.0.1"), - IsBYOL: ne.Bool(true), - LicenseToken: ne.String("sWf3df4gaAvbbexw45ga4f"), - ACLTemplateUUID: ne.String("a624178c-6d59-4798-9a7f-2ddf2c7c5881"), - AccountNumber: ne.String("123456"), - Notifications: []string{"bla@bla.com"}, - PurchaseOrderNumber: ne.String("1234567890"), - TermLength: ne.Int(1), - AdditionalBandwidth: ne.Int(50), - OrderReference: ne.String("12312121sddsf1231"), - InterfaceCount: ne.Int(10), - WanInterfaceId: ne.String("6"), - CoreCount: ne.Int(2), - IsSelfManaged: ne.Bool(true), - DiverseFromDeviceUUID: ne.String("68ccfd49-39b1-478e-957a-67c72f719d7a"), - DiverseFromDeviceName: ne.String("diverseFromDeviceName"), + Name: ne.String("device"), + TypeCode: ne.String("CSR1000V"), + ProjectID: ne.String("68ccfd49-39b1-478e-957a-67c72f719d7a"), + MetroCode: ne.String("SV"), + Throughput: ne.Int(100), + ThroughputUnit: ne.String("Mbps"), + HostName: ne.String("test"), + PackageCode: ne.String("SEC"), + Version: ne.String("9.0.1"), + IsBYOL: ne.Bool(true), + LicenseToken: ne.String("sWf3df4gaAvbbexw45ga4f"), + ACLTemplateUUID: ne.String("a624178c-6d59-4798-9a7f-2ddf2c7c5881"), + AccountNumber: ne.String("123456"), + Notifications: []string{"bla@bla.com"}, + PurchaseOrderNumber: ne.String("1234567890"), + TermLength: ne.Int(1), + AdditionalBandwidth: ne.Int(50), + OrderReference: ne.String("12312121sddsf1231"), + InterfaceCount: ne.Int(10), + WanInterfaceId: ne.String("6"), + CoreCount: ne.Int(2), + IsSelfManaged: ne.Bool(true), + DiverseFromDeviceUUID: ne.String("68ccfd49-39b1-478e-957a-67c72f719d7a"), + DiverseFromDeviceName: ne.String("diverseFromDeviceName"), + IsGenerateDefaultPassword: ne.Bool(false), VendorConfiguration: map[string]string{ "key": "value", }, @@ -131,7 +134,7 @@ func TestNetworkDevice_updateResourceData(t *testing.T) { inputSecondary := &ne.Device{} secondarySchemaLicenseFile := "/tmp/licenseFileSec" d := schema.TestResourceDataRaw(t, createNetworkDeviceSchema(), make(map[string]interface{})) - d.Set(neDeviceSchemaNames["Secondary"], flattenNetworkDeviceSecondary(&ne.Device{ + _ = d.Set(neDeviceSchemaNames["Secondary"], flattenNetworkDeviceSecondary(&ne.Device{ LicenseFile: ne.String(secondarySchemaLicenseFile), })) // when @@ -167,6 +170,7 @@ func TestNetworkDevice_updateResourceData(t *testing.T) { assert.Equal(t, ne.StringValue(inputPrimary.ProjectID), d.Get(neDeviceSchemaNames["ProjectID"]), "ProjectID matches") assert.Equal(t, ne.StringValue(inputPrimary.DiverseFromDeviceUUID), d.Get(neDeviceSchemaNames["DiverseFromDeviceUUID"]), "DiverseFromDeviceUUID matches") assert.Equal(t, ne.StringValue(inputPrimary.DiverseFromDeviceName), d.Get(neDeviceSchemaNames["DiverseFromDeviceName"]), "DiverseFromDeviceName matches") + assert.Equal(t, ne.BoolValue(inputPrimary.IsGenerateDefaultPassword), d.Get(neDeviceSchemaNames["IsGenerateDefaultPassword"]), "IsGenerateDefaultPassword matches") assert.Equal(t, secondarySchemaLicenseFile, ne.StringValue(expandNetworkDeviceSecondary(d.Get(neDeviceSchemaNames["Secondary"]).([]interface{})).LicenseFile), "Secondary LicenseFile matches") } diff --git a/examples/resources/equinix_network_device/c8000v_byol_without_default_password.tf b/examples/resources/equinix_network_device/c8000v_byol_without_default_password.tf new file mode 100644 index 000000000..5284c308d --- /dev/null +++ b/examples/resources/equinix_network_device/c8000v_byol_without_default_password.tf @@ -0,0 +1,27 @@ +# Create C8000V BYOL device with bandwidth tier information + +data "equinix_network_account" "sv" { + metro_code = "SV" +} + +resource "equinix_network_device" "c8000v-byol-withtout-default-password" { + name = "tf-c8000v-byol" + metro_code = data.equinix_network_account.sv.metro_code + type_code = "C8000V" + self_managed = true + byol = true + generate_default_password = false + 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 a78da011b..87053c477 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( github.com/equinix/equinix-sdk-go v0.46.0 - github.com/equinix/ne-go v1.18.0 + github.com/equinix/ne-go v1.19.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 96e1ae997..f25cafd21 100644 --- a/go.sum +++ b/go.sum @@ -41,8 +41,8 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/equinix/equinix-sdk-go v0.46.0 h1:ldQo4GtXNr+0XsThQJf/pUdx5wcLFe9QpLFtAwonqH8= github.com/equinix/equinix-sdk-go v0.46.0/go.mod h1:hEb3XLaedz7xhl/dpPIS6eOIiXNPeqNiVoyDrT6paIg= -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/ne-go v1.19.0 h1:aueOpe8yh/t3/mjhc/R3ZGAIPYSvixNQ/fU3t2HUQZk= +github.com/equinix/ne-go v1.19.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/resources/network_device.md.tmpl b/templates/resources/network_device.md.tmpl index 307118b20..24e0f4db2 100644 --- a/templates/resources/network_device.md.tmpl +++ b/templates/resources/network_device.md.tmpl @@ -50,6 +50,8 @@ In addition to management modes, there are two software license modes available: {{tffile "examples/resources/equinix_network_device/zscaler_pse.tf"}} +{{tffile "examples/resources/equinix_network_device/c8000v_byol_without_default_password.tf"}} + ## Argument Reference The following arguments are supported: @@ -87,6 +89,9 @@ The following arguments are supported: * `connectivity` - (Optional) Device accessibility (INTERNET-ACCESS or PRIVATE or INTERNET-ACCESS-WITH-PRVT-MGMT). If not specified, default will be INTERNET-ACCESS * `project_id` - (Optional) Unique Identifier for the project resource where the device is scoped to.If you leave it out, the device will be created under the default project id of your organization. * `diverse_device_id` - (Optional) Unique ID of an existing device. Use this field to let Equinix know if you want your new device to be in a different location from any existing virtual device. This field is only meaningful for single devices. +* `generate_default_password` - (Optional) Boolean value that determines to create device with or without default password. Use this field to let Equinix know if you want your new device to be create with default admin password. +This field is only meaningful for C8000V Autonomous(single/ha) and Fortinet Firewall devices(single/ha/cluster). If not specified, by default device is created with admin password. + ### Secondary Device