From 921c6995153d31a523bafb4c59c17791a61a93d5 Mon Sep 17 00:00:00 2001 From: Marques Johansson Date: Tue, 24 Sep 2024 20:16:18 -0400 Subject: [PATCH] chore(goimports): goimports -w -local github.com/equinix/terraform-provider-equinix on networkedge files Signed-off-by: Marques Johansson --- .../account/data_source_acc_test.go | 5 +- .../networkedge/acl_template/resource_test.go | 3 +- .../networkedge/acl_template/sweeper.go | 3 +- .../networkedge/device/resource_test.go | 3 +- .../resources/networkedge/device/sweeper.go | 3 +- .../networkedge/device_link/sweeper.go | 3 +- .../device_software/data_source_acc_test.go | 3 +- .../device_type/data_source_acc_test.go | 5 +- .../resources/networkedge/file/resource.go | 1 + .../platform/data_source_acc_test.go | 3 +- .../resources/networkedge/ssh_key/sweeper.go | 3 +- .../networkedge/ssh_user/resource_acc_test.go | 63 ------------------- .../networkedge/ssh_user/resource_test.go | 3 +- .../resources/networkedge/ssh_user/sweeper.go | 3 +- 14 files changed, 27 insertions(+), 77 deletions(-) diff --git a/internal/resources/networkedge/account/data_source_acc_test.go b/internal/resources/networkedge/account/data_source_acc_test.go index c5ec33255..5e92bef6c 100644 --- a/internal/resources/networkedge/account/data_source_acc_test.go +++ b/internal/resources/networkedge/account/data_source_acc_test.go @@ -4,10 +4,11 @@ import ( "fmt" "testing" - "github.com/equinix/terraform-provider-equinix/internal/acceptance" - "github.com/equinix/terraform-provider-equinix/internal/nprintf" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/equinix/terraform-provider-equinix/internal/acceptance" + "github.com/equinix/terraform-provider-equinix/internal/nprintf" ) const ( diff --git a/internal/resources/networkedge/acl_template/resource_test.go b/internal/resources/networkedge/acl_template/resource_test.go index 7eaa7b097..94cb5dd13 100644 --- a/internal/resources/networkedge/acl_template/resource_test.go +++ b/internal/resources/networkedge/acl_template/resource_test.go @@ -4,9 +4,10 @@ import ( "testing" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/converters" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/stretchr/testify/assert" + + "github.com/equinix/terraform-provider-equinix/internal/converters" ) func TestNetworkACLTemplate_createFromResourceData(t *testing.T) { diff --git a/internal/resources/networkedge/acl_template/sweeper.go b/internal/resources/networkedge/acl_template/sweeper.go index 504282984..2c482dcfc 100644 --- a/internal/resources/networkedge/acl_template/sweeper.go +++ b/internal/resources/networkedge/acl_template/sweeper.go @@ -6,8 +6,9 @@ import ( "log" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/sweep" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/equinix/terraform-provider-equinix/internal/sweep" ) func AddTestSweeper() { diff --git a/internal/resources/networkedge/device/resource_test.go b/internal/resources/networkedge/device/resource_test.go index b5e530b29..9ec3fdda1 100644 --- a/internal/resources/networkedge/device/resource_test.go +++ b/internal/resources/networkedge/device/resource_test.go @@ -9,9 +9,10 @@ import ( "time" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/converters" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/stretchr/testify/assert" + + "github.com/equinix/terraform-provider-equinix/internal/converters" ) func TestNetworkDevice_createFromResourceData(t *testing.T) { diff --git a/internal/resources/networkedge/device/sweeper.go b/internal/resources/networkedge/device/sweeper.go index 373cd9ef3..e2059a5d5 100644 --- a/internal/resources/networkedge/device/sweeper.go +++ b/internal/resources/networkedge/device/sweeper.go @@ -6,8 +6,9 @@ import ( "log" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/sweep" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/equinix/terraform-provider-equinix/internal/sweep" ) func AddTestSweeper() { diff --git a/internal/resources/networkedge/device_link/sweeper.go b/internal/resources/networkedge/device_link/sweeper.go index 21ea813d9..a269f085c 100644 --- a/internal/resources/networkedge/device_link/sweeper.go +++ b/internal/resources/networkedge/device_link/sweeper.go @@ -6,8 +6,9 @@ import ( "log" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/sweep" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/equinix/terraform-provider-equinix/internal/sweep" ) func AddTestSweeper() { diff --git a/internal/resources/networkedge/device_software/data_source_acc_test.go b/internal/resources/networkedge/device_software/data_source_acc_test.go index 3f0ee4193..c75159317 100644 --- a/internal/resources/networkedge/device_software/data_source_acc_test.go +++ b/internal/resources/networkedge/device_software/data_source_acc_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/equinix/terraform-provider-equinix/internal/acceptance" "github.com/equinix/terraform-provider-equinix/internal/nprintf" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccDataSourceNetworkDeviceSoftware_versionRegex(t *testing.T) { diff --git a/internal/resources/networkedge/device_type/data_source_acc_test.go b/internal/resources/networkedge/device_type/data_source_acc_test.go index 13fc01b0a..e8a27c2c3 100644 --- a/internal/resources/networkedge/device_type/data_source_acc_test.go +++ b/internal/resources/networkedge/device_type/data_source_acc_test.go @@ -4,10 +4,11 @@ import ( "fmt" "testing" - "github.com/equinix/terraform-provider-equinix/internal/acceptance" - "github.com/equinix/terraform-provider-equinix/internal/nprintf" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/equinix/terraform-provider-equinix/internal/acceptance" + "github.com/equinix/terraform-provider-equinix/internal/nprintf" ) const networkDeviceMetroEnvVar = "TF_ACC_NETWORK_DEVICE_METRO" diff --git a/internal/resources/networkedge/file/resource.go b/internal/resources/networkedge/file/resource.go index 8c7b9d336..275d950ad 100644 --- a/internal/resources/networkedge/file/resource.go +++ b/internal/resources/networkedge/file/resource.go @@ -8,6 +8,7 @@ import ( "github.com/equinix/ne-go" "github.com/equinix/rest-go" + "github.com/equinix/terraform-provider-equinix/internal/config" equinix_validation "github.com/equinix/terraform-provider-equinix/internal/validation" diff --git a/internal/resources/networkedge/platform/data_source_acc_test.go b/internal/resources/networkedge/platform/data_source_acc_test.go index ead75852a..308d75567 100644 --- a/internal/resources/networkedge/platform/data_source_acc_test.go +++ b/internal/resources/networkedge/platform/data_source_acc_test.go @@ -4,9 +4,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/equinix/terraform-provider-equinix/internal/acceptance" "github.com/equinix/terraform-provider-equinix/internal/nprintf" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccDataSourceNetworkDevicePlatform_basic(t *testing.T) { diff --git a/internal/resources/networkedge/ssh_key/sweeper.go b/internal/resources/networkedge/ssh_key/sweeper.go index 54652eed5..7e221951d 100644 --- a/internal/resources/networkedge/ssh_key/sweeper.go +++ b/internal/resources/networkedge/ssh_key/sweeper.go @@ -6,8 +6,9 @@ import ( "log" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/sweep" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/equinix/terraform-provider-equinix/internal/sweep" ) func AddTestSweeper() { diff --git a/internal/resources/networkedge/ssh_user/resource_acc_test.go b/internal/resources/networkedge/ssh_user/resource_acc_test.go index 9737f8dfd..846e5323d 100644 --- a/internal/resources/networkedge/ssh_user/resource_acc_test.go +++ b/internal/resources/networkedge/ssh_user/resource_acc_test.go @@ -1,67 +1,4 @@ package ssh_user -import ( - "fmt" - - "github.com/equinix/terraform-provider-equinix/internal/acceptance" - "github.com/equinix/terraform-provider-equinix/internal/comparisons" - "github.com/equinix/terraform-provider-equinix/internal/config" - - "github.com/equinix/ne-go" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" -) - // SSH User acc tests are in Device acc test tests // reason: SSH User requires device to be provisioned and that is time consuming operation - -type testAccConfig struct { - ctx map[string]interface{} - config string -} - -func newTestAccConfig(ctx map[string]interface{}) *testAccConfig { - return &testAccConfig{ - ctx: ctx, - config: "", - } -} - -func (t *testAccConfig) build() string { - return t.config -} - -func testAccNeSSHUserExists(resourceName string, user *ne.SSHUser) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[resourceName] - if !ok { - return fmt.Errorf("resource not found: %s", resourceName) - } - if rs.Primary.ID == "" { - return fmt.Errorf("resource has no ID attribute set") - } - client := acceptance.TestAccProvider.Meta().(*config.Config).Ne - resp, err := client.GetSSHUser(rs.Primary.ID) - if err != nil { - return fmt.Errorf("error when fetching SSH user '%s': %s", rs.Primary.ID, err) - } - *user = *resp - return nil - } -} - -func testAccNeSSHUserAttributes(user *ne.SSHUser, devices []*ne.Device, ctx map[string]interface{}) resource.TestCheckFunc { - return func(s *terraform.State) error { - if v, ok := ctx["username"]; ok && ne.StringValue(user.Username) != v.(string) { - return fmt.Errorf("name does not match %v - %v", ne.StringValue(user.Username), v) - } - deviceIDs := make([]string, len(devices)) - for i := range devices { - deviceIDs[i] = ne.StringValue(devices[i].UUID) - } - if !comparisons.SlicesMatch(deviceIDs, user.DeviceUUIDs) { - return fmt.Errorf("device_ids does not match %v - %v", deviceIDs, user.DeviceUUIDs) - } - return nil - } -} diff --git a/internal/resources/networkedge/ssh_user/resource_test.go b/internal/resources/networkedge/ssh_user/resource_test.go index 9b7463f08..5cfa9e1fc 100644 --- a/internal/resources/networkedge/ssh_user/resource_test.go +++ b/internal/resources/networkedge/ssh_user/resource_test.go @@ -4,9 +4,10 @@ import ( "testing" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/converters" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/stretchr/testify/assert" + + "github.com/equinix/terraform-provider-equinix/internal/converters" ) func TestNetworkSSHUser_resourceFromResourceData(t *testing.T) { diff --git a/internal/resources/networkedge/ssh_user/sweeper.go b/internal/resources/networkedge/ssh_user/sweeper.go index 92079df62..dd5e8e71d 100644 --- a/internal/resources/networkedge/ssh_user/sweeper.go +++ b/internal/resources/networkedge/ssh_user/sweeper.go @@ -6,8 +6,9 @@ import ( "log" "github.com/equinix/ne-go" - "github.com/equinix/terraform-provider-equinix/internal/sweep" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/equinix/terraform-provider-equinix/internal/sweep" ) func AddTestSweeper() {