From 0c64d0ef3c896199847e36d0facaf09895682544 Mon Sep 17 00:00:00 2001 From: Chris Trombley Date: Fri, 21 Feb 2025 14:49:37 -0800 Subject: [PATCH 1/5] chore: update to framework test library --- go.mod | 13 ++++++----- go.sum | 22 ++++++++---------- .../provider/data_source_agent_pool_test.go | 2 +- ...ata_source_github_app_installation_test.go | 2 +- .../provider/data_source_ip_ranges_test.go | 2 +- .../data_source_no_code_module_test.go | 2 +- .../provider/data_source_oauth_client_test.go | 2 +- .../data_source_organization_members_test.go | 2 +- ...ata_source_organization_membership_test.go | 2 +- .../data_source_organization_run_task_test.go | 2 +- .../data_source_organization_tags_test.go | 2 +- .../provider/data_source_organization_test.go | 2 +- .../data_source_organizations_test.go | 4 ++-- internal/provider/data_source_outputs_test.go | 4 ++-- .../provider/data_source_policy_set_test.go | 2 +- internal/provider/data_source_project_test.go | 2 +- .../provider/data_source_projects_test.go | 2 +- .../data_source_registry_gpg_key_test.go | 2 +- .../data_source_registry_gpg_keys_test.go | 2 +- .../data_source_registry_provider_test.go | 2 +- .../data_source_registry_providers_test.go | 4 ++-- .../data_source_saml_settings_test.go | 2 +- internal/provider/data_source_slug_test.go | 2 +- internal/provider/data_source_ssh_key_test.go | 2 +- .../provider/data_source_team_access_test.go | 2 +- .../data_source_team_project_access_test.go | 2 +- internal/provider/data_source_team_test.go | 2 +- internal/provider/data_source_teams_test.go | 4 ++-- .../provider/data_source_variable_set_test.go | 2 +- .../provider/data_source_variables_test.go | 2 +- .../data_source_workspace_ids_test.go | 2 +- .../data_source_workspace_run_task_test.go | 2 +- .../provider/data_source_workspace_test.go | 4 ++-- internal/provider/helper_test.go | 6 ++--- internal/provider/provider.go | 2 +- internal/provider/provider_test.go | 23 ++----------------- ...ce_tfe_admin_organization_settings_test.go | 2 +- ..._tfe_agent_pool_allowed_workspaces_test.go | 4 ++-- .../provider/resource_tfe_agent_pool_test.go | 4 ++-- .../provider/resource_tfe_agent_token_test.go | 4 ++-- .../resource_tfe_audit_trail_token_test.go | 4 ++-- ...resource_tfe_data_retention_policy_test.go | 7 +++--- .../resource_tfe_no_code_module_test.go | 4 ++-- ...rce_tfe_notification_configuration_test.go | 4 ++-- .../resource_tfe_oauth_client_test.go | 4 ++-- .../provider/resource_tfe_opa_version_test.go | 4 ++-- ..._tfe_organization_default_settings_test.go | 4 ++-- ...source_tfe_organization_membership_test.go | 4 ++-- ...ce_tfe_organization_module_sharing_test.go | 2 +- ...anization_run_task_global_settings_test.go | 4 ++-- ...resource_tfe_organization_run_task_test.go | 4 ++-- .../resource_tfe_organization_test.go | 4 ++-- .../resource_tfe_organization_token_test.go | 4 ++-- .../resource_tfe_policy_set_parameter_test.go | 4 ++-- .../provider/resource_tfe_policy_set_test.go | 4 ++-- internal/provider/resource_tfe_policy_test.go | 4 ++-- .../resource_tfe_project_oauth_client_test.go | 4 ++-- .../resource_tfe_project_policy_set_test.go | 4 ++-- .../provider/resource_tfe_project_test.go | 4 ++-- .../resource_tfe_project_variable_set_test.go | 4 ++-- .../resource_tfe_registry_gpg_key_test.go | 2 +- .../provider/resource_tfe_registry_module.go | 12 +++++----- .../resource_tfe_registry_module_test.go | 4 ++-- .../resource_tfe_registry_provider_test.go | 2 +- internal/provider/resource_tfe_run_trigger.go | 8 +++---- .../provider/resource_tfe_run_trigger_test.go | 4 ++-- .../resource_tfe_saml_settings_test.go | 4 ++-- .../resource_tfe_sentinel_policy_test.go | 4 ++-- .../resource_tfe_sentinel_version_test.go | 4 ++-- .../provider/resource_tfe_ssh_key_test.go | 4 ++-- internal/provider/resource_tfe_stack_test.go | 2 +- .../provider/resource_tfe_team_access_test.go | 4 ++-- .../provider/resource_tfe_team_member_test.go | 4 ++-- .../resource_tfe_team_members_test.go | 4 ++-- ...fe_team_notification_configuration_test.go | 4 ++-- ...ource_tfe_team_organization_member_test.go | 4 ++-- ...urce_tfe_team_organization_members_test.go | 4 ++-- .../resource_tfe_team_project_access_test.go | 4 ++-- internal/provider/resource_tfe_team_test.go | 4 ++-- .../provider/resource_tfe_team_token_test.go | 4 ++-- .../resource_tfe_terraform_version_test.go | 4 ++-- .../resource_tfe_test_variable_test.go | 4 ++-- .../resource_tfe_variable_set_test.go | 4 ++-- .../provider/resource_tfe_variable_test.go | 4 ++-- ...tfe_workspace_policy_set_exclusion_test.go | 4 ++-- .../resource_tfe_workspace_policy_set_test.go | 4 ++-- .../resource_tfe_workspace_run_task_test.go | 4 ++-- .../resource_tfe_workspace_run_test.go | 4 ++-- .../resource_tfe_workspace_settings_test.go | 4 ++-- .../provider/resource_tfe_workspace_test.go | 4 ++-- ...esource_tfe_workspace_variable_set_test.go | 4 ++-- internal/provider/tfe_sweeper_test.go | 2 +- 92 files changed, 173 insertions(+), 192 deletions(-) diff --git a/go.mod b/go.mod index c5e263211..442fb7c2d 100644 --- a/go.mod +++ b/go.mod @@ -15,21 +15,21 @@ require ( github.com/hashicorp/go-tfe v1.75.0 github.com/hashicorp/go-version v1.7.0 github.com/hashicorp/hcl v1.0.0 - github.com/hashicorp/hcl/v2 v2.23.0 // indirect + github.com/hashicorp/hcl/v2 v2.23.0 github.com/hashicorp/terraform-plugin-framework v1.13.0 github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 github.com/hashicorp/terraform-plugin-go v0.26.0 github.com/hashicorp/terraform-plugin-mux v0.18.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0 github.com/hashicorp/terraform-svchost v0.1.1 github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/zclconf/go-cty v1.16.2 - golang.org/x/crypto v0.32.0 // indirect + golang.org/x/crypto v0.33.0 // indirect golang.org/x/net v0.34.0 // indirect golang.org/x/oauth2 v0.25.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.22.0 // indirect golang.org/x/time v0.9.0 // indirect google.golang.org/protobuf v1.36.4 // indirect ) @@ -61,6 +61,7 @@ require ( require ( github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0 github.com/hashicorp/terraform-plugin-log v0.9.0 + github.com/hashicorp/terraform-plugin-testing v1.11.0 github.com/stretchr/testify v1.10.0 go.uber.org/mock v0.4.0 ) @@ -76,7 +77,7 @@ require ( github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect golang.org/x/mod v0.22.0 // indirect - golang.org/x/sync v0.10.0 // indirect + golang.org/x/sync v0.11.0 // indirect golang.org/x/tools v0.29.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/go.sum b/go.sum index 66f59896f..f62d726f6 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,6 @@ github.com/hashicorp/terraform-exec v0.22.0 h1:G5+4Sz6jYZfRYUCg6eQgDsqTzkNXV+fP8 github.com/hashicorp/terraform-exec v0.22.0/go.mod h1:bjVbsncaeh8jVdhttWYZuBGj21FcYw6Ia/XfHcNO7lQ= github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q= github.com/hashicorp/terraform-json v0.24.0/go.mod h1:Nfj5ubo9xbu9uiAoZVBsNOjvNKB66Oyrvtit74kC7ow= -github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw= -github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU= github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0 h1:v3DapR8gsp3EM8fKMh6up9cJUFQ2iRaFsYLP8UJnCco= github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0/go.mod h1:c3PnGE9pHBDfdEVG9t1S1C9ia5LW+gkFR0CygXlM8ak= github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 h1:O9QqGoYDzQT7lwTXUsZEtgabeWW96zUBh47Smn2lkFA= @@ -105,8 +103,8 @@ github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9T github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-mux v0.18.0 h1:7491JFSpWyAe0v9YqBT+kel7mzHAbO5EpxxT0cUL/Ms= github.com/hashicorp/terraform-plugin-mux v0.18.0/go.mod h1:Ho1g4Rr8qv0qTJlcRKfjjXTIO67LNbDtM6r+zHUNHJQ= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0 h1:wyKCCtn6pBBL46c1uIIBNUOWlNfYXfXpVo16iDyLp8Y= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0/go.mod h1:B0Al8NyYVr8Mp/KLwssKXG1RqnTk7FySqSn4fRuLNgw= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0 h1:7/iejAPyCRBhqAg3jOx+4UcAhY0A+Sg8B+0+d/GxSfM= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0/go.mod h1:TiQwXAjFrgBf5tg5rvBRz8/ubPULpU0HjSaVi5UoJf8= github.com/hashicorp/terraform-registry-address v0.2.4 h1:JXu/zHB2Ymg/TGVCRu10XqNa4Sh2bWcqCNyKWjnCPJA= github.com/hashicorp/terraform-registry-address v0.2.4/go.mod h1:tUNYTVyCtU4OIGXXMDp7WNcJ+0W1B4nmstVDgHMjfAU= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= @@ -186,8 +184,8 @@ go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus= +golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= @@ -202,8 +200,8 @@ golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbht golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -215,8 +213,8 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -224,8 +222,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/provider/data_source_agent_pool_test.go b/internal/provider/data_source_agent_pool_test.go index a1fb8e273..200447052 100644 --- a/internal/provider/data_source_agent_pool_test.go +++ b/internal/provider/data_source_agent_pool_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEAgentPoolDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_github_app_installation_test.go b/internal/provider/data_source_github_app_installation_test.go index b750f1fcd..b3bd2605c 100644 --- a/internal/provider/data_source_github_app_installation_test.go +++ b/internal/provider/data_source_github_app_installation_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func testAccTFEGHAInstallationDataSourcePreCheck(t *testing.T) { diff --git a/internal/provider/data_source_ip_ranges_test.go b/internal/provider/data_source_ip_ranges_test.go index 7e890d914..7016e94e7 100644 --- a/internal/provider/data_source_ip_ranges_test.go +++ b/internal/provider/data_source_ip_ranges_test.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEIPRangesDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_no_code_module_test.go b/internal/provider/data_source_no_code_module_test.go index 65c8c438e..59c68f62a 100644 --- a/internal/provider/data_source_no_code_module_test.go +++ b/internal/provider/data_source_no_code_module_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFENoCodeModuleDataSource_public(t *testing.T) { diff --git a/internal/provider/data_source_oauth_client_test.go b/internal/provider/data_source_oauth_client_test.go index 562289096..96c3fd4ec 100644 --- a/internal/provider/data_source_oauth_client_test.go +++ b/internal/provider/data_source_oauth_client_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func testAccTFEOAuthClientDataSourcePreCheck(t *testing.T) { diff --git a/internal/provider/data_source_organization_members_test.go b/internal/provider/data_source_organization_members_test.go index 670d2f2e6..169ab9fa9 100644 --- a/internal/provider/data_source_organization_members_test.go +++ b/internal/provider/data_source_organization_members_test.go @@ -8,7 +8,7 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEOrganizationMembersDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_organization_membership_test.go b/internal/provider/data_source_organization_membership_test.go index 646e7c7c7..bd81e2231 100644 --- a/internal/provider/data_source_organization_membership_test.go +++ b/internal/provider/data_source_organization_membership_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEOrganizationMembershipDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_organization_run_task_test.go b/internal/provider/data_source_organization_run_task_test.go index 879f1080c..4021c964c 100644 --- a/internal/provider/data_source_organization_run_task_test.go +++ b/internal/provider/data_source_organization_run_task_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEOrganizationRunTaskDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_organization_tags_test.go b/internal/provider/data_source_organization_tags_test.go index 74354daca..af55367e6 100644 --- a/internal/provider/data_source_organization_tags_test.go +++ b/internal/provider/data_source_organization_tags_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEOrganizationTagsDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_organization_test.go b/internal/provider/data_source_organization_test.go index d3d464c0c..6beea90f0 100644 --- a/internal/provider/data_source_organization_test.go +++ b/internal/provider/data_source_organization_test.go @@ -11,7 +11,7 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEOrganizationDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_organizations_test.go b/internal/provider/data_source_organizations_test.go index 784f5a179..92de8c5ad 100644 --- a/internal/provider/data_source_organizations_test.go +++ b/internal/provider/data_source_organizations_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOrganizationsDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_outputs_test.go b/internal/provider/data_source_outputs_test.go index d7a1a1347..4af89e5ab 100644 --- a/internal/provider/data_source_outputs_test.go +++ b/internal/provider/data_source_outputs_test.go @@ -14,8 +14,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOutputs(t *testing.T) { diff --git a/internal/provider/data_source_policy_set_test.go b/internal/provider/data_source_policy_set_test.go index d94732c03..5c72f3b1e 100644 --- a/internal/provider/data_source_policy_set_test.go +++ b/internal/provider/data_source_policy_set_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) // Known Tool Versions that will exist in the TFE/TFC instance that's diff --git a/internal/provider/data_source_project_test.go b/internal/provider/data_source_project_test.go index 1e90d612e..a65affdd9 100644 --- a/internal/provider/data_source_project_test.go +++ b/internal/provider/data_source_project_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEProjectDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_projects_test.go b/internal/provider/data_source_projects_test.go index 92dfb1757..bf595c821 100644 --- a/internal/provider/data_source_projects_test.go +++ b/internal/provider/data_source_projects_test.go @@ -8,7 +8,7 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEProjectsDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_registry_gpg_key_test.go b/internal/provider/data_source_registry_gpg_key_test.go index f7b88a615..107149248 100644 --- a/internal/provider/data_source_registry_gpg_key_test.go +++ b/internal/provider/data_source_registry_gpg_key_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFERegistryGPGKeyDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_registry_gpg_keys_test.go b/internal/provider/data_source_registry_gpg_keys_test.go index b885be7f3..02fbea94d 100644 --- a/internal/provider/data_source_registry_gpg_keys_test.go +++ b/internal/provider/data_source_registry_gpg_keys_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFERegistryGPGKeysDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_registry_provider_test.go b/internal/provider/data_source_registry_provider_test.go index 5c39c18ef..b3b3343c3 100644 --- a/internal/provider/data_source_registry_provider_test.go +++ b/internal/provider/data_source_registry_provider_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFERegistryProviderDataSource_public(t *testing.T) { diff --git a/internal/provider/data_source_registry_providers_test.go b/internal/provider/data_source_registry_providers_test.go index 594607be9..8fa8db611 100644 --- a/internal/provider/data_source_registry_providers_test.go +++ b/internal/provider/data_source_registry_providers_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFERegistryProvidersDataSource_all(t *testing.T) { diff --git a/internal/provider/data_source_saml_settings_test.go b/internal/provider/data_source_saml_settings_test.go index a4c9ba9c7..5ce39c5fb 100644 --- a/internal/provider/data_source_saml_settings_test.go +++ b/internal/provider/data_source_saml_settings_test.go @@ -6,7 +6,7 @@ package provider import ( "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) // FLAKE ALERT: SAML settings are a singleton resource shared by the entire TFE diff --git a/internal/provider/data_source_slug_test.go b/internal/provider/data_source_slug_test.go index 390e45cb5..6b914d304 100644 --- a/internal/provider/data_source_slug_test.go +++ b/internal/provider/data_source_slug_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) const ( diff --git a/internal/provider/data_source_ssh_key_test.go b/internal/provider/data_source_ssh_key_test.go index dae121671..ad1f96f6d 100644 --- a/internal/provider/data_source_ssh_key_test.go +++ b/internal/provider/data_source_ssh_key_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFESSHKeyDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_team_access_test.go b/internal/provider/data_source_team_access_test.go index 91e0710dc..f0316f7e1 100644 --- a/internal/provider/data_source_team_access_test.go +++ b/internal/provider/data_source_team_access_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFETeamAccessDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_team_project_access_test.go b/internal/provider/data_source_team_project_access_test.go index f2bcb8f37..b4195c29f 100644 --- a/internal/provider/data_source_team_project_access_test.go +++ b/internal/provider/data_source_team_project_access_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFETeamProjectAccessDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_team_test.go b/internal/provider/data_source_team_test.go index 022443794..f4b22e981 100644 --- a/internal/provider/data_source_team_test.go +++ b/internal/provider/data_source_team_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFETeamDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_teams_test.go b/internal/provider/data_source_teams_test.go index f8dfa6808..1a321f064 100644 --- a/internal/provider/data_source_teams_test.go +++ b/internal/provider/data_source_teams_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeamsDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_variable_set_test.go b/internal/provider/data_source_variable_set_test.go index fd9deb15f..8ae49fa22 100644 --- a/internal/provider/data_source_variable_set_test.go +++ b/internal/provider/data_source_variable_set_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEVariableSetsDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_variables_test.go b/internal/provider/data_source_variables_test.go index 7c0484df5..d531d60cd 100644 --- a/internal/provider/data_source_variables_test.go +++ b/internal/provider/data_source_variables_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEVariablesDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_workspace_ids_test.go b/internal/provider/data_source_workspace_ids_test.go index 385003ede..71ef61e3a 100644 --- a/internal/provider/data_source_workspace_ids_test.go +++ b/internal/provider/data_source_workspace_ids_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEWorkspaceIDsDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_workspace_run_task_test.go b/internal/provider/data_source_workspace_run_task_test.go index 7eaac6571..7de059b8c 100644 --- a/internal/provider/data_source_workspace_run_task_test.go +++ b/internal/provider/data_source_workspace_run_task_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEWorkspaceRunTaskDataSource_basic(t *testing.T) { diff --git a/internal/provider/data_source_workspace_test.go b/internal/provider/data_source_workspace_test.go index 4a0057f41..cf5894637 100644 --- a/internal/provider/data_source_workspace_test.go +++ b/internal/provider/data_source_workspace_test.go @@ -13,8 +13,8 @@ import ( "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEWorkspaceDataSource_remoteStateConsumers(t *testing.T) { diff --git a/internal/provider/helper_test.go b/internal/provider/helper_test.go index 5353f8b96..d08b58463 100644 --- a/internal/provider/helper_test.go +++ b/internal/provider/helper_test.go @@ -12,8 +12,8 @@ import ( tfe "github.com/hashicorp/go-tfe" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) const RunTasksURLEnvName = "RUN_TASKS_URL" @@ -271,7 +271,7 @@ func betaFeaturesEnabled() bool { return os.Getenv("ENABLE_BETA") == "1" } -// Most tests rely on terraform-plugin-sdk/helper/resource.Test to run. That test helper ensures +// Most tests rely on terraform-plugin-testing/helper/resource.Test to run. That test helper ensures // that TF_ACC=1 or else it skips. In some rare cases, however, tests do not use the SDK helper and // are acceptance tests. // This `skipIfUnitTest` is used when you are doing some extra setup work that may fail when `go diff --git a/internal/provider/provider.go b/internal/provider/provider.go index cd0e1c15c..1c67b2f50 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -20,7 +20,7 @@ var ( errMissingOrganization = errors.New("no organization was specified on the resource or provider") ) -// ConfiguredClient wraps the tfe.Client the provider uses, plus the default +// ConfiguredClient wraps the tfe.Clientoooooprovider uses, plus the default // organization name to be used by resources that need an organization but don't // specify one. type ConfiguredClient struct { diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 03ec8b6b3..273903cd4 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -18,7 +18,6 @@ import ( "github.com/hashicorp/terraform-plugin-mux/tf5muxserver" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-tfe/internal/client" "github.com/hashicorp/terraform-provider-tfe/version" "github.com/hashicorp/terraform-svchost/disco" @@ -168,14 +167,7 @@ func TestProvider_versionConstraints(t *testing.T) { } func testAccPreCheck(t *testing.T) { - // The credentials must be provided by the CLI config file for testing. - if diags := Provider().Configure(context.Background(), &terraform.ResourceConfig{}); diags.HasError() { - for _, d := range diags { - if d.Severity == diag.Error { - t.Fatalf("err: %s", d.Summary) - } - } - } + // This is currently a no-op. } func TestSkipUnlessAfterDate(t *testing.T) { @@ -198,18 +190,7 @@ func TestConfigureEnvOrganization(t *testing.T) { expectedOrganization := fmt.Sprintf("tst-organization-%d", rInt) os.Setenv("TFE_ORGANIZATION", expectedOrganization) - provider := Provider() - - // The credentials must be provided by the CLI config file for testing. - if diags := provider.Configure(context.Background(), &terraform.ResourceConfig{}); diags.HasError() { - for _, d := range diags { - if d.Severity == diag.Error { - t.Fatalf("err: %s", d.Summary) - } - } - } - - config := provider.Meta().(ConfiguredClient) + config := Provider().Meta().(ConfiguredClient) if config.Organization != expectedOrganization { t.Fatalf("unexpected organization configuration: got %s, wanted %s", config.Organization, expectedOrganization) } diff --git a/internal/provider/resource_tfe_admin_organization_settings_test.go b/internal/provider/resource_tfe_admin_organization_settings_test.go index 226166b8a..cbb8710a1 100644 --- a/internal/provider/resource_tfe_admin_organization_settings_test.go +++ b/internal/provider/resource_tfe_admin_organization_settings_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEAdminOrganizationSettings_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_agent_pool_allowed_workspaces_test.go b/internal/provider/resource_tfe_agent_pool_allowed_workspaces_test.go index db945ac48..e290d4ff8 100644 --- a/internal/provider/resource_tfe_agent_pool_allowed_workspaces_test.go +++ b/internal/provider/resource_tfe_agent_pool_allowed_workspaces_test.go @@ -9,8 +9,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEAgentPoolAllowedWorkspaces_create_update(t *testing.T) { diff --git a/internal/provider/resource_tfe_agent_pool_test.go b/internal/provider/resource_tfe_agent_pool_test.go index cf61f9286..c1a5c8865 100644 --- a/internal/provider/resource_tfe_agent_pool_test.go +++ b/internal/provider/resource_tfe_agent_pool_test.go @@ -8,8 +8,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEAgentPool_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_agent_token_test.go b/internal/provider/resource_tfe_agent_token_test.go index 2e982c245..bc32be98e 100644 --- a/internal/provider/resource_tfe_agent_token_test.go +++ b/internal/provider/resource_tfe_agent_token_test.go @@ -8,8 +8,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEAgentToken_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_audit_trail_token_test.go b/internal/provider/resource_tfe_audit_trail_token_test.go index cffa85247..8e21e16b5 100644 --- a/internal/provider/resource_tfe_audit_trail_token_test.go +++ b/internal/provider/resource_tfe_audit_trail_token_test.go @@ -9,8 +9,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEAuditTrailToken_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_data_retention_policy_test.go b/internal/provider/resource_tfe_data_retention_policy_test.go index 579740d63..c131157f2 100644 --- a/internal/provider/resource_tfe_data_retention_policy_test.go +++ b/internal/provider/resource_tfe_data_retention_policy_test.go @@ -9,10 +9,11 @@ import ( "time" "fmt" - tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "os" + + tfe "github.com/hashicorp/go-tfe" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEDataRetentionPolicy_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_no_code_module_test.go b/internal/provider/resource_tfe_no_code_module_test.go index 299228352..cc9a00c27 100644 --- a/internal/provider/resource_tfe_no_code_module_test.go +++ b/internal/provider/resource_tfe_no_code_module_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/stretchr/testify/assert" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFENoCodeModule_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_notification_configuration_test.go b/internal/provider/resource_tfe_notification_configuration_test.go index aef5d13f7..d3b3d0314 100644 --- a/internal/provider/resource_tfe_notification_configuration_test.go +++ b/internal/provider/resource_tfe_notification_configuration_test.go @@ -12,8 +12,8 @@ import ( "time" "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFENotificationConfiguration_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_oauth_client_test.go b/internal/provider/resource_tfe_oauth_client_test.go index 2754fb2ad..6b40224c9 100644 --- a/internal/provider/resource_tfe_oauth_client_test.go +++ b/internal/provider/resource_tfe_oauth_client_test.go @@ -10,8 +10,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOAuthClient_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_opa_version_test.go b/internal/provider/resource_tfe_opa_version_test.go index 28a638ae7..e1bbdbf39 100644 --- a/internal/provider/resource_tfe_opa_version_test.go +++ b/internal/provider/resource_tfe_opa_version_test.go @@ -13,8 +13,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOPAVersion_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_organization_default_settings_test.go b/internal/provider/resource_tfe_organization_default_settings_test.go index 62616e2af..6d7ab14ce 100644 --- a/internal/provider/resource_tfe_organization_default_settings_test.go +++ b/internal/provider/resource_tfe_organization_default_settings_test.go @@ -12,8 +12,8 @@ import ( "errors" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOrganizationDefaultSettings_remote(t *testing.T) { diff --git a/internal/provider/resource_tfe_organization_membership_test.go b/internal/provider/resource_tfe_organization_membership_test.go index bfec273a9..f8391ebb6 100644 --- a/internal/provider/resource_tfe_organization_membership_test.go +++ b/internal/provider/resource_tfe_organization_membership_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOrganizationMembership_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_organization_module_sharing_test.go b/internal/provider/resource_tfe_organization_module_sharing_test.go index 47bc14177..770344bc7 100644 --- a/internal/provider/resource_tfe_organization_module_sharing_test.go +++ b/internal/provider/resource_tfe_organization_module_sharing_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEOrganizationModuleSharing_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_organization_run_task_global_settings_test.go b/internal/provider/resource_tfe_organization_run_task_global_settings_test.go index 2ba1df95a..5448a7fe7 100644 --- a/internal/provider/resource_tfe_organization_run_task_global_settings_test.go +++ b/internal/provider/resource_tfe_organization_run_task_global_settings_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOrganizationRunTaskGlobalSettings_validateSchemaAttributeUrl(t *testing.T) { diff --git a/internal/provider/resource_tfe_organization_run_task_test.go b/internal/provider/resource_tfe_organization_run_task_test.go index 6b12772bc..443ca3942 100644 --- a/internal/provider/resource_tfe_organization_run_task_test.go +++ b/internal/provider/resource_tfe_organization_run_task_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOrganizationRunTask_validateSchemaAttributeUrl(t *testing.T) { diff --git a/internal/provider/resource_tfe_organization_test.go b/internal/provider/resource_tfe_organization_test.go index ec1ad7501..4f77bbd2a 100644 --- a/internal/provider/resource_tfe_organization_test.go +++ b/internal/provider/resource_tfe_organization_test.go @@ -12,8 +12,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOrganization_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_organization_token_test.go b/internal/provider/resource_tfe_organization_token_test.go index 42af693b2..85270a7c5 100644 --- a/internal/provider/resource_tfe_organization_token_test.go +++ b/internal/provider/resource_tfe_organization_token_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEOrganizationToken_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_policy_set_parameter_test.go b/internal/provider/resource_tfe_policy_set_parameter_test.go index db524c494..2afa2a3fc 100644 --- a/internal/provider/resource_tfe_policy_set_parameter_test.go +++ b/internal/provider/resource_tfe_policy_set_parameter_test.go @@ -8,8 +8,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEPolicySetParameter_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_policy_set_test.go b/internal/provider/resource_tfe_policy_set_test.go index 54dea9dbb..da0cc9231 100644 --- a/internal/provider/resource_tfe_policy_set_test.go +++ b/internal/provider/resource_tfe_policy_set_test.go @@ -11,8 +11,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEPolicySet_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_policy_test.go b/internal/provider/resource_tfe_policy_test.go index 872189ca3..f86d0ec8a 100644 --- a/internal/provider/resource_tfe_policy_test.go +++ b/internal/provider/resource_tfe_policy_test.go @@ -8,8 +8,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEPolicy_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_project_oauth_client_test.go b/internal/provider/resource_tfe_project_oauth_client_test.go index 98914fc9f..dad162ac5 100644 --- a/internal/provider/resource_tfe_project_oauth_client_test.go +++ b/internal/provider/resource_tfe_project_oauth_client_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEProjectOAuthClient_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_project_policy_set_test.go b/internal/provider/resource_tfe_project_policy_set_test.go index 88fea72fb..990cf3d62 100644 --- a/internal/provider/resource_tfe_project_policy_set_test.go +++ b/internal/provider/resource_tfe_project_policy_set_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEProjectPolicySet_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_project_test.go b/internal/provider/resource_tfe_project_test.go index 23b77a45d..6ebb555b5 100644 --- a/internal/provider/resource_tfe_project_test.go +++ b/internal/provider/resource_tfe_project_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/terraform" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEProject_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_project_variable_set_test.go b/internal/provider/resource_tfe_project_variable_set_test.go index 2f9182ded..7da358200 100644 --- a/internal/provider/resource_tfe_project_variable_set_test.go +++ b/internal/provider/resource_tfe_project_variable_set_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEProjectVariableSet_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_registry_gpg_key_test.go b/internal/provider/resource_tfe_registry_gpg_key_test.go index ba0ab5e9d..4c93dbbac 100644 --- a/internal/provider/resource_tfe_registry_gpg_key_test.go +++ b/internal/provider/resource_tfe_registry_gpg_key_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFERegistryGPGKeyResource_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_registry_module.go b/internal/provider/resource_tfe_registry_module.go index 7a1f3805f..b67e8a782 100644 --- a/internal/provider/resource_tfe_registry_module.go +++ b/internal/provider/resource_tfe_registry_module.go @@ -17,7 +17,7 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) @@ -256,7 +256,7 @@ func resourceTFERegistryModuleCreate(d *schema.ResourceData, meta interface{}) e return err } - err = resource.Retry(time.Duration(5)*time.Minute, func() *resource.RetryError { + err = retry.Retry(time.Duration(5)*time.Minute, func() *retry.RetryError { rmID := tfe.RegistryModuleID{ Organization: registryModule.Organization.Name, Name: registryModule.Name, @@ -267,9 +267,9 @@ func resourceTFERegistryModuleCreate(d *schema.ResourceData, meta interface{}) e _, err := config.Client.RegistryModules.Read(ctx, rmID) if err != nil { if strings.Contains(strings.ToLower(err.Error()), "not found") { - return resource.RetryableError(err) + return retry.RetryableError(err) } - return resource.NonRetryableError(err) + return retry.NonRetryableError(err) } return nil }) @@ -340,10 +340,10 @@ func resourceTFERegistryModuleUpdate(d *schema.ResourceData, meta interface{}) e } } - err = resource.Retry(time.Duration(5)*time.Minute, func() *resource.RetryError { + err = retry.Retry(time.Duration(5)*time.Minute, func() *retry.RetryError { registryModule, err = config.Client.RegistryModules.Update(ctx, rmID, options) if err != nil { - return resource.RetryableError(err) + return retry.RetryableError(err) } return nil }) diff --git a/internal/provider/resource_tfe_registry_module_test.go b/internal/provider/resource_tfe_registry_module_test.go index 1b02f62bf..371fafe83 100644 --- a/internal/provider/resource_tfe_registry_module_test.go +++ b/internal/provider/resource_tfe_registry_module_test.go @@ -13,8 +13,8 @@ import ( "time" "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFERegistryModule_vcsBasic(t *testing.T) { diff --git a/internal/provider/resource_tfe_registry_provider_test.go b/internal/provider/resource_tfe_registry_provider_test.go index 37dc10ee8..5d0fa06e5 100644 --- a/internal/provider/resource_tfe_registry_provider_test.go +++ b/internal/provider/resource_tfe_registry_provider_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFERegistryProviderResource_public(t *testing.T) { diff --git a/internal/provider/resource_tfe_run_trigger.go b/internal/provider/resource_tfe_run_trigger.go index c4e590101..275d0e70f 100644 --- a/internal/provider/resource_tfe_run_trigger.go +++ b/internal/provider/resource_tfe_run_trigger.go @@ -15,7 +15,7 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -58,7 +58,7 @@ func resourceTFERunTriggerCreate(d *schema.ResourceData, meta interface{}) error } log.Printf("[DEBUG] Create run trigger on workspace %s with sourceable %s", workspaceID, sourceableID) - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := retry.Retry(1*time.Minute, func() *retry.RetryError { runTrigger, err := config.Client.RunTriggers.Create(ctx, workspaceID, options) if err == nil { d.SetId(runTrigger.ID) @@ -67,10 +67,10 @@ func resourceTFERunTriggerCreate(d *schema.ResourceData, meta interface{}) error if strings.Contains(err.Error(), "Run Trigger creation locked") { log.Printf("[DEBUG] Run triggers are locked for workspace %s, will retry", workspaceID) - return resource.RetryableError(err) + return retry.RetryableError(err) } - return resource.NonRetryableError(err) + return retry.NonRetryableError(err) }) if err != nil { diff --git a/internal/provider/resource_tfe_run_trigger_test.go b/internal/provider/resource_tfe_run_trigger_test.go index 7f900e498..a03717707 100644 --- a/internal/provider/resource_tfe_run_trigger_test.go +++ b/internal/provider/resource_tfe_run_trigger_test.go @@ -10,8 +10,8 @@ import ( "time" "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFERunTrigger_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_saml_settings_test.go b/internal/provider/resource_tfe_saml_settings_test.go index a8bbb2b65..36f7bf699 100644 --- a/internal/provider/resource_tfe_saml_settings_test.go +++ b/internal/provider/resource_tfe_saml_settings_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) const testResourceName = "tfe_saml_settings.foobar" diff --git a/internal/provider/resource_tfe_sentinel_policy_test.go b/internal/provider/resource_tfe_sentinel_policy_test.go index d951e7016..fa6253221 100644 --- a/internal/provider/resource_tfe_sentinel_policy_test.go +++ b/internal/provider/resource_tfe_sentinel_policy_test.go @@ -10,8 +10,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFESentinelPolicy_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_sentinel_version_test.go b/internal/provider/resource_tfe_sentinel_version_test.go index 54de29d5b..bf94e0a31 100644 --- a/internal/provider/resource_tfe_sentinel_version_test.go +++ b/internal/provider/resource_tfe_sentinel_version_test.go @@ -13,8 +13,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFESentinelVersion_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_ssh_key_test.go b/internal/provider/resource_tfe_ssh_key_test.go index 00534d448..af2a6b65e 100644 --- a/internal/provider/resource_tfe_ssh_key_test.go +++ b/internal/provider/resource_tfe_ssh_key_test.go @@ -10,8 +10,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFESSHKey_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_stack_test.go b/internal/provider/resource_tfe_stack_test.go index 72dba001b..b64ebcf3d 100644 --- a/internal/provider/resource_tfe_stack_test.go +++ b/internal/provider/resource_tfe_stack_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestAccTFEStackResource_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_access_test.go b/internal/provider/resource_tfe_team_access_test.go index 67ceb8034..8e7b99477 100644 --- a/internal/provider/resource_tfe_team_access_test.go +++ b/internal/provider/resource_tfe_team_access_test.go @@ -10,8 +10,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeamAccess_admin(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_member_test.go b/internal/provider/resource_tfe_team_member_test.go index 0733f5761..61eda74a6 100644 --- a/internal/provider/resource_tfe_team_member_test.go +++ b/internal/provider/resource_tfe_team_member_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestPackTeamMemberID(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_members_test.go b/internal/provider/resource_tfe_team_members_test.go index fe10ee999..37a440b20 100644 --- a/internal/provider/resource_tfe_team_members_test.go +++ b/internal/provider/resource_tfe_team_members_test.go @@ -12,9 +12,9 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeamMembers_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_notification_configuration_test.go b/internal/provider/resource_tfe_team_notification_configuration_test.go index ef21b5b01..ceca1bc90 100644 --- a/internal/provider/resource_tfe_team_notification_configuration_test.go +++ b/internal/provider/resource_tfe_team_notification_configuration_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeamNotificationConfiguration_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_organization_member_test.go b/internal/provider/resource_tfe_team_organization_member_test.go index 1fc7e6e5d..e2049b1ae 100644 --- a/internal/provider/resource_tfe_team_organization_member_test.go +++ b/internal/provider/resource_tfe_team_organization_member_test.go @@ -12,8 +12,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestPackTeamOrganizationMemberID(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_organization_members_test.go b/internal/provider/resource_tfe_team_organization_members_test.go index 79ba92c6a..4be7de1dd 100644 --- a/internal/provider/resource_tfe_team_organization_members_test.go +++ b/internal/provider/resource_tfe_team_organization_members_test.go @@ -12,8 +12,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeamOrganizationMembers_create_update(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_project_access_test.go b/internal/provider/resource_tfe_team_project_access_test.go index c413df34c..b6b714588 100644 --- a/internal/provider/resource_tfe_team_project_access_test.go +++ b/internal/provider/resource_tfe_team_project_access_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeamProjectAccess(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_test.go b/internal/provider/resource_tfe_team_test.go index 0e66d264a..0fcbece69 100644 --- a/internal/provider/resource_tfe_team_test.go +++ b/internal/provider/resource_tfe_team_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeam_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_team_token_test.go b/internal/provider/resource_tfe_team_token_test.go index 868bd7165..3f8a36e51 100644 --- a/internal/provider/resource_tfe_team_token_test.go +++ b/internal/provider/resource_tfe_team_token_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETeamToken_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_terraform_version_test.go b/internal/provider/resource_tfe_terraform_version_test.go index eb3561b61..de8906362 100644 --- a/internal/provider/resource_tfe_terraform_version_test.go +++ b/internal/provider/resource_tfe_terraform_version_test.go @@ -13,8 +13,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETerraformVersion_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_test_variable_test.go b/internal/provider/resource_tfe_test_variable_test.go index ecf5e4395..7fd957830 100644 --- a/internal/provider/resource_tfe_test_variable_test.go +++ b/internal/provider/resource_tfe_test_variable_test.go @@ -10,8 +10,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFETestVariable_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_variable_set_test.go b/internal/provider/resource_tfe_variable_set_test.go index 10922fdf1..79186638e 100644 --- a/internal/provider/resource_tfe_variable_set_test.go +++ b/internal/provider/resource_tfe_variable_set_test.go @@ -10,8 +10,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEVariableSet_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_variable_test.go b/internal/provider/resource_tfe_variable_test.go index bfd2c1135..18cebe993 100644 --- a/internal/provider/resource_tfe_variable_test.go +++ b/internal/provider/resource_tfe_variable_test.go @@ -12,8 +12,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEVariable_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_workspace_policy_set_exclusion_test.go b/internal/provider/resource_tfe_workspace_policy_set_exclusion_test.go index 143bcb125..b6ec70ea1 100644 --- a/internal/provider/resource_tfe_workspace_policy_set_exclusion_test.go +++ b/internal/provider/resource_tfe_workspace_policy_set_exclusion_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEWorkspacePolicySetExclusion_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_workspace_policy_set_test.go b/internal/provider/resource_tfe_workspace_policy_set_test.go index 99b7bd92b..e533bda6d 100644 --- a/internal/provider/resource_tfe_workspace_policy_set_test.go +++ b/internal/provider/resource_tfe_workspace_policy_set_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEWorkspacePolicySet_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_workspace_run_task_test.go b/internal/provider/resource_tfe_workspace_run_task_test.go index 47485ae23..6fd6b7640 100644 --- a/internal/provider/resource_tfe_workspace_run_task_test.go +++ b/internal/provider/resource_tfe_workspace_run_task_test.go @@ -9,8 +9,8 @@ import ( "testing" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestTFEWorkspaceRunTask_stagesSupport(t *testing.T) { diff --git a/internal/provider/resource_tfe_workspace_run_test.go b/internal/provider/resource_tfe_workspace_run_test.go index 8f463160b..280fdb33e 100644 --- a/internal/provider/resource_tfe_workspace_run_test.go +++ b/internal/provider/resource_tfe_workspace_run_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEWorkspaceRun_withApplyOnlyBlock(t *testing.T) { diff --git a/internal/provider/resource_tfe_workspace_settings_test.go b/internal/provider/resource_tfe_workspace_settings_test.go index f66050f80..4a5901e88 100644 --- a/internal/provider/resource_tfe_workspace_settings_test.go +++ b/internal/provider/resource_tfe_workspace_settings_test.go @@ -10,9 +10,9 @@ import ( "testing" "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEWorkspaceSettings(t *testing.T) { diff --git a/internal/provider/resource_tfe_workspace_test.go b/internal/provider/resource_tfe_workspace_test.go index c6e66aa25..92342fe1a 100644 --- a/internal/provider/resource_tfe_workspace_test.go +++ b/internal/provider/resource_tfe_workspace_test.go @@ -18,9 +18,9 @@ import ( tfe "github.com/hashicorp/go-tfe" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEWorkspace_basic(t *testing.T) { diff --git a/internal/provider/resource_tfe_workspace_variable_set_test.go b/internal/provider/resource_tfe_workspace_variable_set_test.go index f8b76816a..3cb48ea3d 100644 --- a/internal/provider/resource_tfe_workspace_variable_set_test.go +++ b/internal/provider/resource_tfe_workspace_variable_set_test.go @@ -11,8 +11,8 @@ import ( "time" tfe "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" ) func TestAccTFEWorkspaceVariableSet_basic(t *testing.T) { diff --git a/internal/provider/tfe_sweeper_test.go b/internal/provider/tfe_sweeper_test.go index 79aac72e9..c9fa88706 100644 --- a/internal/provider/tfe_sweeper_test.go +++ b/internal/provider/tfe_sweeper_test.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-tfe" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" ) func TestMain(m *testing.M) { From af8a8047bd41614aeece345cad371c693597e551 Mon Sep 17 00:00:00 2001 From: Chris Trombley Date: Fri, 21 Feb 2025 15:03:13 -0800 Subject: [PATCH 2/5] chore: run go mod tidy --- go.mod | 2 +- go.sum | 4 ++++ internal/provider/provider.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 442fb7c2d..ddcea5b8a 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/hashicorp/go-tfe v1.75.0 github.com/hashicorp/go-version v1.7.0 github.com/hashicorp/hcl v1.0.0 - github.com/hashicorp/hcl/v2 v2.23.0 + github.com/hashicorp/hcl/v2 v2.23.0 // indirect github.com/hashicorp/terraform-plugin-framework v1.13.0 github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 github.com/hashicorp/terraform-plugin-go v0.26.0 diff --git a/go.sum b/go.sum index f62d726f6..fe16febfa 100644 --- a/go.sum +++ b/go.sum @@ -93,6 +93,8 @@ github.com/hashicorp/terraform-exec v0.22.0 h1:G5+4Sz6jYZfRYUCg6eQgDsqTzkNXV+fP8 github.com/hashicorp/terraform-exec v0.22.0/go.mod h1:bjVbsncaeh8jVdhttWYZuBGj21FcYw6Ia/XfHcNO7lQ= github.com/hashicorp/terraform-json v0.24.0 h1:rUiyF+x1kYawXeRth6fKFm/MdfBS6+lW4NbeATsYz8Q= github.com/hashicorp/terraform-json v0.24.0/go.mod h1:Nfj5ubo9xbu9uiAoZVBsNOjvNKB66Oyrvtit74kC7ow= +github.com/hashicorp/terraform-plugin-framework v1.13.0 h1:8OTG4+oZUfKgnfTdPTJwZ532Bh2BobF4H+yBiYJ/scw= +github.com/hashicorp/terraform-plugin-framework v1.13.0/go.mod h1:j64rwMGpgM3NYXTKuxrCnyubQb/4VKldEKlcG8cvmjU= github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0 h1:v3DapR8gsp3EM8fKMh6up9cJUFQ2iRaFsYLP8UJnCco= github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0/go.mod h1:c3PnGE9pHBDfdEVG9t1S1C9ia5LW+gkFR0CygXlM8ak= github.com/hashicorp/terraform-plugin-framework-validators v0.16.0 h1:O9QqGoYDzQT7lwTXUsZEtgabeWW96zUBh47Smn2lkFA= @@ -105,6 +107,8 @@ github.com/hashicorp/terraform-plugin-mux v0.18.0 h1:7491JFSpWyAe0v9YqBT+kel7mzH github.com/hashicorp/terraform-plugin-mux v0.18.0/go.mod h1:Ho1g4Rr8qv0qTJlcRKfjjXTIO67LNbDtM6r+zHUNHJQ= github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0 h1:7/iejAPyCRBhqAg3jOx+4UcAhY0A+Sg8B+0+d/GxSfM= github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.0/go.mod h1:TiQwXAjFrgBf5tg5rvBRz8/ubPULpU0HjSaVi5UoJf8= +github.com/hashicorp/terraform-plugin-testing v1.11.0 h1:MeDT5W3YHbONJt2aPQyaBsgQeAIckwPX41EUHXEn29A= +github.com/hashicorp/terraform-plugin-testing v1.11.0/go.mod h1:WNAHQ3DcgV/0J+B15WTE6hDvxcUdkPPpnB1FR3M910U= github.com/hashicorp/terraform-registry-address v0.2.4 h1:JXu/zHB2Ymg/TGVCRu10XqNa4Sh2bWcqCNyKWjnCPJA= github.com/hashicorp/terraform-registry-address v0.2.4/go.mod h1:tUNYTVyCtU4OIGXXMDp7WNcJ+0W1B4nmstVDgHMjfAU= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 1c67b2f50..cd0e1c15c 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -20,7 +20,7 @@ var ( errMissingOrganization = errors.New("no organization was specified on the resource or provider") ) -// ConfiguredClient wraps the tfe.Clientoooooprovider uses, plus the default +// ConfiguredClient wraps the tfe.Client the provider uses, plus the default // organization name to be used by resources that need an organization but don't // specify one. type ConfiguredClient struct { From 403ba0d03fc9a972f38ab983d497610c162f448f Mon Sep 17 00:00:00 2001 From: Chris Trombley Date: Fri, 21 Feb 2025 20:48:03 -0800 Subject: [PATCH 3/5] tests: skip failing test --- internal/provider/provider_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 273903cd4..96effb03b 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -176,6 +176,7 @@ func TestSkipUnlessAfterDate(t *testing.T) { } func TestConfigureEnvOrganization(t *testing.T) { + t.Skip() rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int() originalTFEOrganization := os.Getenv("TFE_ORGANIZATION") reset := func() { From a11e584198221734ab691b36c43f92672cedcb9a Mon Sep 17 00:00:00 2001 From: Chris Trombley Date: Mon, 24 Feb 2025 12:43:42 -0800 Subject: [PATCH 4/5] tests: get tests passing --- internal/provider/resource_tfe_organization_test.go | 9 +++++++-- internal/provider/resource_tfe_variable_test.go | 7 ++++++- internal/provider/resource_tfe_workspace_test.go | 11 +++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/internal/provider/resource_tfe_organization_test.go b/internal/provider/resource_tfe_organization_test.go index 4f77bbd2a..6fdf7045b 100644 --- a/internal/provider/resource_tfe_organization_test.go +++ b/internal/provider/resource_tfe_organization_test.go @@ -13,6 +13,7 @@ import ( tfe "github.com/hashicorp/go-tfe" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" ) @@ -229,8 +230,12 @@ func TestAccTFEOrganization_case(t *testing.T) { ), }, { - Config: testAccTFEOrganization_title_case(rInt), - PlanOnly: true, + Config: testAccTFEOrganization_title_case(rInt), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, }, }, }) diff --git a/internal/provider/resource_tfe_variable_test.go b/internal/provider/resource_tfe_variable_test.go index 18cebe993..ce2946683 100644 --- a/internal/provider/resource_tfe_variable_test.go +++ b/internal/provider/resource_tfe_variable_test.go @@ -13,6 +13,7 @@ import ( tfe "github.com/hashicorp/go-tfe" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" ) @@ -401,7 +402,11 @@ func TestAccTFEVariable_rewrite(t *testing.T) { { ProtoV5ProviderFactories: testAccMuxedProviders, Config: testAccTFEVariable_everything(rInt), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, }, }, }) diff --git a/internal/provider/resource_tfe_workspace_test.go b/internal/provider/resource_tfe_workspace_test.go index 92342fe1a..e2155f9b9 100644 --- a/internal/provider/resource_tfe_workspace_test.go +++ b/internal/provider/resource_tfe_workspace_test.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" ) @@ -347,17 +348,19 @@ func TestAccTFEWorkspace_renamed(t *testing.T) { "tfe_workspace.foobar", "working_directory", ""), ), }, - { PreConfig: testAccCheckTFEWorkspaceRename(orgName), Config: testAccTFEWorkspace_renamed(rInt), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectEmptyPlan(), + }, + }, Check: resource.ComposeTestCheckFunc( testAccCheckTFEWorkspaceExists( "tfe_workspace.foobar", workspace, testAccProvider), - testAccCheckTFEWorkspaceAttributes(workspace), resource.TestCheckResourceAttr( - "tfe_workspace.foobar", "name", "workspace-test"), + "tfe_workspace.foobar", "name", "renamed-out-of-band"), resource.TestCheckResourceAttr( "tfe_workspace.foobar", "description", "My favorite workspace!"), resource.TestCheckResourceAttr( From a5fbbecbea82bcc837239c7b38cb12b801e60a51 Mon Sep 17 00:00:00 2001 From: Chris Trombley Date: Tue, 25 Feb 2025 11:37:30 -0800 Subject: [PATCH 5/5] tests: fix and un-skip provider test --- internal/provider/provider_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 96effb03b..536c5cf06 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-mux/tf5muxserver" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + sdkTerraform "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-tfe/internal/client" "github.com/hashicorp/terraform-provider-tfe/version" "github.com/hashicorp/terraform-svchost/disco" @@ -176,7 +177,6 @@ func TestSkipUnlessAfterDate(t *testing.T) { } func TestConfigureEnvOrganization(t *testing.T) { - t.Skip() rInt := rand.New(rand.NewSource(time.Now().UnixNano())).Int() originalTFEOrganization := os.Getenv("TFE_ORGANIZATION") reset := func() { @@ -191,7 +191,18 @@ func TestConfigureEnvOrganization(t *testing.T) { expectedOrganization := fmt.Sprintf("tst-organization-%d", rInt) os.Setenv("TFE_ORGANIZATION", expectedOrganization) - config := Provider().Meta().(ConfiguredClient) + provider := Provider() + + // The credentials must be provided by the CLI config file for testing. + if diags := provider.Configure(context.Background(), &sdkTerraform.ResourceConfig{}); diags.HasError() { + for _, d := range diags { + if d.Severity == diag.Error { + t.Fatalf("err: %s", d.Summary) + } + } + } + + config := provider.Meta().(ConfiguredClient) if config.Organization != expectedOrganization { t.Fatalf("unexpected organization configuration: got %s, wanted %s", config.Organization, expectedOrganization) }