Skip to content

Commit

Permalink
Merge branch 'main' into CXF-104038-Zside-Port-Service-Token-Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
srushti-patl authored Nov 19, 2024
2 parents 07494ef + 2738579 commit 540cc98
Show file tree
Hide file tree
Showing 45 changed files with 324 additions and 173 deletions.
63 changes: 62 additions & 1 deletion docs/resources/network_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,66 @@ resource "equinix_network_device" "aviatrix-transit-edge-single" {
}
```

```terraform
# Create ZSCALER APPC device
data "equinix_network_account" "sv" {
metro_code = "SV"
}
resource "equinix_network_device" "zscaler-appc-single" {
name = "tf-zscaler-appc"
project_id = "XXXXXX"
metro_code = data.equinix_network_account.sv.metro_code
type_code = "ZSCALER-APPC"
self_managed = true
byol = true
connectivity = "PRIVATE"
package_code = "STD"
notifications = ["[email protected]", "[email protected]", "[email protected]"]
term_length = 12
account_number = data.equinix_network_account.sv.number
version = "23.395.1"
interface_count = 1
core_count = 4
vendor_configuration = {"provisioningKey" = "XXXXXXXXXX", "hostname" = "XXXX"}
ssh_key {
username = "test"
key_name = "test-key"
}
}
```

```terraform
# Create ZSCALER APPC device
data "equinix_network_account" "sv" {
metro_code = "SV"
}
resource "equinix_network_device" "zscaler-pse-single" {
name = "tf-zscaler-pse"
project_id = "XXXXXX"
metro_code = data.equinix_network_account.sv.metro_code
type_code = "ZSCALER-PSE"
self_managed = true
byol = true
connectivity = "PRIVATE"
package_code = "STD"
notifications = ["[email protected]", "[email protected]", "[email protected]"]
term_length = 12
account_number = data.equinix_network_account.sv.number
version = "23.395.1"
interface_count = 1
core_count = 4
vendor_configuration = {"provisioningKey" = "XXXXXXXXXX", "hostname" = "XXXX"}
ssh_key {
username = "test"
key_name = "test-key"
}
}
```

## Argument Reference

The following arguments are supported:
Expand Down Expand Up @@ -522,7 +582,7 @@ The following arguments are supported:
* `additional_bandwidth` - (Optional) Additional Internet bandwidth, in Mbps, that will be allocated to the device (in addition to default 15Mbps).
* `interface_count` - (Optional) Number of network interfaces on a device. If not specified, default number for a given device type will be used.
* `wan_interafce_id` - (Optional) Specify the WAN/SSH interface id. If not specified, default WAN/SSH interface for a given device type will be used.
* `vendor_configuration` - (Optional) Map of vendor specific configuration parameters for a device (controller1, activationKey, managementType, siteId, systemIpAddress, privateAddress, privateCidrMask, privateGateway, licenseKey, licenseId, panoramaAuthKey, panoramaIpAddress)
* `vendor_configuration` - (Optional) Map of vendor specific configuration parameters for a device (controller1, activationKey, managementType, siteId, systemIpAddress, privateAddress, privateCidrMask, privateGateway, licenseKey, licenseId, panoramaAuthKey, panoramaIpAddress, provisioningKey)
* `ssh-key` - (Optional) Definition of SSH key that will be provisioned on a device (max one key). See [SSH Key](#ssh-key) below for more details.
* `secondary_device` - (Optional) Definition of secondary device for redundant 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.
Expand Down Expand Up @@ -588,6 +648,7 @@ The `vendor_configuration` block supports the following arguments:
* `root_password` - (Optional) The CLI password of the device. This field is relevant only for the Velocloud SDWAN cluster.
* `panorama_ip_address` - (Optional) Panorama Server IP Address. This field is relevant only for the PA-VM firewall devices to have integration with Panorama Server.
* `panorama_auth_key` - (Optional) Panorama Server Auth Key. This field is relevant only for the PA-VM firewall devices to have integration with Panorama Server.
* `provisioning_key` - (Optional) Provisioning Key. This field is relevant only for the ZSCALER APPC and ZSCALER PSE devices.

## Attributes Reference

Expand Down
2 changes: 1 addition & 1 deletion equinix/data_source_metal_device_bgp_neighbors_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestAccDataSourceMetalDeviceBgpNeighbors(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalDeviceBgpNeighborsConfig(projSuffix),
Expand Down
4 changes: 2 additions & 2 deletions equinix/data_source_metal_facility_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestAccDataSourceMetalFacility_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalFacilityConfig_basic(testFac),
Expand Down Expand Up @@ -51,7 +51,7 @@ func TestAccDataSourceMetalFacility_Features(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalFacilityConfig_missingFeatures(),
Expand Down
2 changes: 1 addition & 1 deletion equinix/data_source_metal_ip_block_ranges_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestAccDataSourceMetalIPBlockRanges_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalIPBlockRangesConfig_basic(rs),
Expand Down
2 changes: 1 addition & 1 deletion equinix/data_source_metal_metro_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestAccDataSourceMetalMetro_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{ // Step 3/4, expected an error with pattern, no match on: Error running pre-apply refresh: exit status 1
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalMetroConfig_basic(testMetro),
Expand Down
6 changes: 3 additions & 3 deletions equinix/data_source_metal_operating_system_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestAccDataSourceMetalOperatingSystem_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalOperatingSystemConfig_basic,
Expand All @@ -35,7 +35,7 @@ func TestAccDataSourceMetalOperatingSystem_notFound(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalOperatingSystemConfig_notFound,
Expand All @@ -57,7 +57,7 @@ func TestAccDataSourceMetalOperatingSystem_ambiguous(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalOperatingSystemConfig_ambiguous,
Expand Down
2 changes: 1 addition & 1 deletion equinix/data_source_metal_plans_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestAccDataSourcePlans_Basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourcePlansConfigBasic(testSlug),
Expand Down
2 changes: 1 addition & 1 deletion equinix/data_source_metal_precreated_ip_block_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestAccDataSourceMetalPreCreatedIPBlock_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccDataSourceMetalPreCreatedIPBlockConfig_basic(rs),
Expand Down
2 changes: 1 addition & 1 deletion equinix/data_source_metal_reserved_ip_block_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestAccDataSourceMetalReservedIPBlock_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalReservedIPBlockCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down
7 changes: 3 additions & 4 deletions equinix/data_source_metal_spot_market_price_acc_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package equinix

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand All @@ -11,7 +10,7 @@ func TestAccDataSourceMetalSpotMarketPrice_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalSpotMarketRequestCheckDestroyed,
Steps: []resource.TestStep{
{
Expand All @@ -28,7 +27,7 @@ func TestAccDataSourceMetalSpotMarketPrice_basic(t *testing.T) {
}

func testAccDataSourceMetalSpotMarketPriceConfig_basic() string {
return fmt.Sprintf(`
return `
data "equinix_metal_spot_market_price" "metro" {
metro = "sv"
plan = "c3.medium.x86"
Expand All @@ -38,5 +37,5 @@ data "equinix_metal_spot_market_price" "facility" {
facility = "sv15"
plan = "c3.medium.x86"
}
`)
`
}
2 changes: 1 addition & 1 deletion equinix/data_source_metal_spot_market_request_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestAccDataSourceMetalSpotMarketRequest_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalSpotMarketRequestCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down
26 changes: 16 additions & 10 deletions equinix/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import (
"github.com/equinix/terraform-provider-equinix/internal/provider"
"github.com/equinix/terraform-provider-equinix/version"

"github.com/hashicorp/terraform-plugin-go/tfprotov6"
"github.com/hashicorp/terraform-plugin-mux/tf5to6server"
"github.com/hashicorp/terraform-plugin-mux/tf6muxserver"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/stretchr/testify/assert"

"github.com/hashicorp/terraform-plugin-framework/providerserver"
"github.com/hashicorp/terraform-plugin-go/tfprotov5"
"github.com/hashicorp/terraform-plugin-mux/tf5muxserver"
)

var (
Expand All @@ -27,16 +28,21 @@ var (
testExternalProviders map[string]resource.ExternalProvider
testAccFrameworkProvider *provider.FrameworkProvider

testAccProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){
"equinix": func() (tfprotov5.ProviderServer, error) {
testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){
"equinix": func() (tfprotov6.ProviderServer, error) {
ctx := context.Background()
providers := []func() tfprotov5.ProviderServer{
testAccProviders["equinix"].GRPCProvider,
providerserver.NewProtocol5(
testAccFrameworkProvider,
),

sdkv2Provider, err := tf5to6server.UpgradeServer(ctx, testAccProviders["equinix"].GRPCProvider)
if err != nil {
return nil, err
}
muxServer, err := tf5muxserver.NewMuxServer(ctx, providers...)

providers := []func() tfprotov6.ProviderServer{
func() tfprotov6.ProviderServer { return sdkv2Provider },
providerserver.NewProtocol6(testAccFrameworkProvider),
}

muxServer, err := tf6muxserver.NewMuxServer(ctx, providers...)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion equinix/resource_metal_bgp_setup_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestAccMetalBGPSetup_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalBGPSetupCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down
4 changes: 2 additions & 2 deletions equinix/resource_metal_ip_attachment_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestAccMetalIPAttachment_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalIPAttachmentCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -75,7 +75,7 @@ func TestAccMetalIPAttachment_metro(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalIPAttachmentCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down
10 changes: 5 additions & 5 deletions equinix/resource_metal_port_vlan_attachment_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestAccMetalPortVlanAttachment_L2Bonded(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalPortVlanAttachmentCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestAccMetalPortVlanAttachment_L2Individual(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalPortVlanAttachmentCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -239,7 +239,7 @@ func TestAccMetalPortVlanAttachment_hybridBasic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalPortVlanAttachmentCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -314,7 +314,7 @@ func TestAccMetalPortVlanAttachment_hybridMultipleVlans(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalPortVlanAttachmentCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -445,7 +445,7 @@ func TestAccMetalPortVlanAttachment_L2Native(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalPortVlanAttachmentCheckDestroyed,
Steps: []resource.TestStep{
{
Expand Down
6 changes: 3 additions & 3 deletions equinix/resource_metal_project_api_key_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestAccMetalProjectAPIKey_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
CheckDestroy: testAccMetalProjectAPIKeyCheckDestroyed,
Steps: []resource.TestStep{
{
Expand All @@ -32,7 +32,7 @@ func TestAccMetalProjectAPIKey_basic(t *testing.T) {
}

func testAccMetalProjectAPIKeyConfig_basic() string {
return fmt.Sprintf(`
return `
resource "equinix_metal_project" "test" {
name = "tfacc-project-key-test"
Expand All @@ -42,7 +42,7 @@ resource "equinix_metal_project_api_key" "test" {
project_id = equinix_metal_project.test.id
description = "tfacc-project-key"
read_only = true
}`)
}`
}

func testAccMetalProjectAPIKeyCheckDestroyed(s *terraform.State) error {
Expand Down
Loading

0 comments on commit 540cc98

Please sign in to comment.