Skip to content

Commit

Permalink
Cleanup deprecated folders (#8720) (#15621)
Browse files Browse the repository at this point in the history
* Remove folder resources and data_sources

* Remove utility files

* Move more utility files

* Fix tgc

* Import provider package in tgc

* Remove utils files

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Aug 24, 2023
1 parent 85b8e82 commit 0e253e0
Show file tree
Hide file tree
Showing 147 changed files with 101 additions and 4,688 deletions.
3 changes: 3 additions & 0 deletions .changelog/8720.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
8 changes: 0 additions & 8 deletions google/acctest/bootstrap_iam_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,3 @@ func BootstrapPSARoles(t *testing.T, prefix, agentName string, roles []string) b
func BootstrapPSARole(t *testing.T, prefix, agentName, role string) bool {
return BootstrapPSARoles(t, prefix, agentName, []string{role})
}

// Returns the bindings that are in the first set of bindings but not the second.
//
// Deprecated: For backward compatibility missingBindings is still working,
// but all new code should use MissingBindings in the tpgiamresource package instead.
func missingBindings(a, b []*cloudresourcemanager.Binding) []*cloudresourcemanager.Binding {
return tpgiamresource.MissingBindings(a, b)
}
23 changes: 0 additions & 23 deletions google/acctest/gcp_sweeper.go

This file was deleted.

221 changes: 8 additions & 213 deletions google/acctest/provider_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,86 +20,6 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

// Deprecated: For backward compatibility TestEnvVar is still working,
// but all new code should use TestEnvVar in the envvar package instead.
const TestEnvVar = envvar.TestEnvVar

// Deprecated: For backward compatibility CredsEnvVars is still working,
// but all new code should use CredsEnvVars in the envvar package instead.
var CredsEnvVars = envvar.CredsEnvVars

// Deprecated: For backward compatibility ProjectNumberEnvVars is still working,
// but all new code should use ProjectNumberEnvVars in the envvar package instead.
var ProjectNumberEnvVars = envvar.ProjectNumberEnvVars

// Deprecated: For backward compatibility ProjectEnvVars is still working,
// but all new code should use ProjectEnvVars in the envvar package instead.
var ProjectEnvVars = envvar.ProjectEnvVars

// Deprecated: For backward compatibility FirestoreProjectEnvVars is still working,
// but all new code should use FirestoreProjectEnvVars in the envvar package instead.
var FirestoreProjectEnvVars = envvar.FirestoreProjectEnvVars

// Deprecated: For backward compatibility RegionEnvVars is still working,
// but all new code should use RegionEnvVars in the envvar package instead.
var RegionEnvVars = envvar.RegionEnvVars

// Deprecated: For backward compatibility ZoneEnvVars is still working,
// but all new code should use ZoneEnvVars in the envvar package instead.
var ZoneEnvVars = envvar.ZoneEnvVars

// Deprecated: For backward compatibility OrgEnvVars is still working,
// but all new code should use OrgEnvVars in the envvar package instead.
var OrgEnvVars = envvar.OrgEnvVars

// This value is the Customer ID of the GOOGLE_ORG_DOMAIN workspace.
// See https://admin.google.com/ac/accountsettings when logged into an org admin for the value.
//
// Deprecated: For backward compatibility CustIdEnvVars is still working,
// but all new code should use CustIdEnvVars in the envvar package instead.
var CustIdEnvVars = envvar.CustIdEnvVars

// This value is the username of an identity account within the GOOGLE_ORG_DOMAIN workspace.
// For example in the org example.com with a user "foo@example.com", this would be set to "foo".
// See https://admin.google.com/ac/users when logged into an org admin for a list.
//
// Deprecated: For backward compatibility IdentityUserEnvVars is still working,
// but all new code should use IdentityUserEnvVars in the envvar package instead.
var IdentityUserEnvVars = envvar.IdentityUserEnvVars

// Deprecated: For backward compatibility OrgEnvDomainVars is still working,
// but all new code should use OrgEnvDomainVars in the envvar package instead.
var OrgEnvDomainVars = envvar.OrgEnvDomainVars

// Deprecated: For backward compatibility ServiceAccountEnvVars is still working,
// but all new code should use ServiceAccountEnvVars in the envvar package instead.
var ServiceAccountEnvVars = envvar.ServiceAccountEnvVars

// Deprecated: For backward compatibility OrgTargetEnvVars is still working,
// but all new code should use OrgTargetEnvVars in the envvar package instead.
var OrgTargetEnvVars = envvar.OrgTargetEnvVars

// This is the billing account that will be charged for the infrastructure used during testing. For
// that reason, it is also the billing account used for creating new projects.
//
// Deprecated: For backward compatibility BillingAccountEnvVars is still working,
// but all new code should use BillingAccountEnvVars in the envvar package instead.
var BillingAccountEnvVars = envvar.BillingAccountEnvVars

// This is the billing account that will be modified to test billing-related functionality. It is
// expected to have more permissions granted to the test user and support subaccounts.
//
// Deprecated: For backward compatibility MasterBillingAccountEnvVars is still working,
// but all new code should use MasterBillingAccountEnvVars in the envvar package instead.
var MasterBillingAccountEnvVars = envvar.MasterBillingAccountEnvVars

// This value is the description used for test PublicAdvertisedPrefix setup to avoid required DNS
// setup. This is only used during integration tests and would be invalid to surface to users
//
// Deprecated: For backward compatibility PapDescriptionEnvVars is still working,
// but all new code should use PapDescriptionEnvVars in the envvar package instead.
var PapDescriptionEnvVars = envvar.PapDescriptionEnvVars

var TestAccProviders map[string]*schema.Provider
var testAccProvider *schema.Provider

Expand Down Expand Up @@ -136,20 +56,20 @@ func AccTestPreCheck(t *testing.T) {
os.Setenv("GOOGLE_CREDENTIALS", string(creds))
}

if v := transport_tpg.MultiEnvSearch(CredsEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(CredsEnvVars, ", "))
if v := transport_tpg.MultiEnvSearch(envvar.CredsEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.CredsEnvVars, ", "))
}

if v := transport_tpg.MultiEnvSearch(ProjectEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(ProjectEnvVars, ", "))
if v := transport_tpg.MultiEnvSearch(envvar.ProjectEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.ProjectEnvVars, ", "))
}

if v := transport_tpg.MultiEnvSearch(RegionEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(RegionEnvVars, ", "))
if v := transport_tpg.MultiEnvSearch(envvar.RegionEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.RegionEnvVars, ", "))
}

if v := transport_tpg.MultiEnvSearch(ZoneEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(ZoneEnvVars, ", "))
if v := transport_tpg.MultiEnvSearch(envvar.ZoneEnvVars); v == "" {
t.Fatalf("One of %s must be set for acceptance tests", strings.Join(envvar.ZoneEnvVars, ", "))
}
}

Expand All @@ -175,125 +95,6 @@ func GetTestProject(is *terraform.InstanceState, config *transport_tpg.Config) (
return "", fmt.Errorf("%q: required field is not set", "project")
}

// AccTestPreCheck ensures at least one of the project env variables is set.
//
// Deprecated: For backward compatibility GetTestProjectNumberFromEnv is still working,
// but all new code should use GetTestProjectNumberFromEnv in the envvar package instead.
func GetTestProjectNumberFromEnv() string {
return envvar.GetTestProjectNumberFromEnv()
}

// AccTestPreCheck ensures at least one of the project env variables is set.
//
// Deprecated: For backward compatibility GetTestProjectFromEnv is still working,
// but all new code should use GetTestProjectFromEnv in the envvar package instead.
func GetTestProjectFromEnv() string {
return envvar.GetTestProjectFromEnv()
}

// AccTestPreCheck ensures at least one of the credentials env variables is set.
//
// Deprecated: For backward compatibility GetTestCredsFromEnv is still working,
// but all new code should use GetTestCredsFromEnv in the envvar package instead.
func GetTestCredsFromEnv() string {
return envvar.GetTestCredsFromEnv()
}

// AccTestPreCheck ensures at least one of the region env variables is set.
//
// Deprecated: For backward compatibility GetTestRegionFromEnv is still working,
// but all new code should use GetTestRegionFromEnv in the envvar package instead.
func GetTestRegionFromEnv() string {
return envvar.GetTestRegionFromEnv()
}

// Deprecated: For backward compatibility GetTestZoneFromEnv is still working,
// but all new code should use GetTestZoneFromEnv in the envvar package instead.
func GetTestZoneFromEnv() string {
return envvar.GetTestZoneFromEnv()
}

// Deprecated: For backward compatibility GetTestCustIdFromEnv is still working,
// but all new code should use GetTestCustIdFromEnv in the envvar package instead.
func GetTestCustIdFromEnv(t *testing.T) string {
return envvar.GetTestCustIdFromEnv(t)
}

// Deprecated: For backward compatibility GetTestIdentityUserFromEnv is still working,
// but all new code should use GetTestIdentityUserFromEnv in the envvar package instead.
func GetTestIdentityUserFromEnv(t *testing.T) string {
return envvar.GetTestIdentityUserFromEnv(t)
}

// Firestore can't be enabled at the same time as Datastore, so we need a new
// project to manage it until we can enable Firestore programmatically.
//
// Deprecated: For backward compatibility GetTestFirestoreProjectFromEnv is still working,
// but all new code should use GetTestFirestoreProjectFromEnv in the envvar package instead.
func GetTestFirestoreProjectFromEnv(t *testing.T) string {
return envvar.GetTestFirestoreProjectFromEnv(t)
}

// Returns the raw organization id like 1234567890, skipping the test if one is
// not found.
//
// Deprecated: For backward compatibility GetTestOrgFromEnv is still working,
// but all new code should use GetTestOrgFromEnv in the envvar package instead.
func GetTestOrgFromEnv(t *testing.T) string {
return envvar.GetTestOrgFromEnv(t)
}

// Alternative to GetTestOrgFromEnv that doesn't need *testing.T
// If using this, you need to process unset values at the call site
//
// Deprecated: For backward compatibility UnsafeGetTestOrgFromEnv is still working,
// but all new code should use UnsafeGetTestOrgFromEnv in the envvar package instead.
func UnsafeGetTestOrgFromEnv() string {
return envvar.UnsafeGetTestOrgFromEnv()
}

// Deprecated: For backward compatibility GetTestOrgDomainFromEnv is still working,
// but all new code should use GetTestOrgDomainFromEnv in the envvar package instead.
func GetTestOrgDomainFromEnv(t *testing.T) string {
return envvar.GetTestOrgDomainFromEnv(t)
}

// Deprecated: For backward compatibility GetTestOrgTargetFromEnv is still working,
// but all new code should use GetTestOrgTargetFromEnv in the envvar package instead.
func GetTestOrgTargetFromEnv(t *testing.T) string {
return envvar.GetTestOrgTargetFromEnv(t)
}

// This is the billing account that will be charged for the infrastructure used during testing. For
// that reason, it is also the billing account used for creating new projects.
//
// Deprecated: For backward compatibility GetTestBillingAccountFromEnv is still working,
// but all new code should use GetTestBillingAccountFromEnv in the envvar package instead.
func GetTestBillingAccountFromEnv(t *testing.T) string {
return envvar.GetTestBillingAccountFromEnv(t)
}

// This is the billing account that will be modified to test billing-related functionality. It is
// expected to have more permissions granted to the test user and support subaccounts.
//
// Deprecated: For backward compatibility GetTestMasterBillingAccountFromEnv is still working,
// but all new code should use GetTestMasterBillingAccountFromEnv in the envvar package instead.
func GetTestMasterBillingAccountFromEnv(t *testing.T) string {
return envvar.GetTestMasterBillingAccountFromEnv(t)
}

// Deprecated: For backward compatibility GetTestServiceAccountFromEnv is still working,
// but all new code should use GetTestServiceAccountFromEnv in the envvar package instead.
func GetTestServiceAccountFromEnv(t *testing.T) string {
return envvar.GetTestServiceAccountFromEnv(t)
}

// Deprecated: For backward compatibility GetTestPublicAdvertisedPrefixDescriptionFromEnv is still working,
// but all new code should use GetTestPublicAdvertisedPrefixDescriptionFromEnv in the envvar package instead.
func GetTestPublicAdvertisedPrefixDescriptionFromEnv(t *testing.T) string {
return envvar.GetTestPublicAdvertisedPrefixDescriptionFromEnv(t)
}

// Some tests fail during VCR. One common case is race conditions when creating resources.
// If a test config adds two fine-grained resources with the same parent it is undefined
// which will be created first, causing VCR to fail ~50% of the time
Expand All @@ -309,9 +110,3 @@ func SleepInSecondsForTest(t int) resource.TestCheckFunc {
return nil
}
}

// Deprecated: For backward compatibility SkipIfEnvNotSet is still working,
// but all new code should use SkipIfEnvNotSet in the envvar package instead.
func SkipIfEnvNotSet(t *testing.T, envs ...string) {
envvar.SkipIfEnvNotSet(t, envs...)
}
22 changes: 0 additions & 22 deletions google/appengine_operation.go

This file was deleted.

48 changes: 0 additions & 48 deletions google/bootstrap_iam_test_utils.go

This file was deleted.

Loading

0 comments on commit 0e253e0

Please sign in to comment.