diff --git a/.changelog/8797.txt b/.changelog/8797.txt new file mode 100644 index 0000000000..8ec013c069 --- /dev/null +++ b/.changelog/8797.txt @@ -0,0 +1,3 @@ +```release-note:none + +``` diff --git a/google-beta/acctest/framework_test_utils.go b/google-beta/acctest/framework_test_utils.go index f557853858..2e83d86126 100644 --- a/google-beta/acctest/framework_test_utils.go +++ b/google-beta/acctest/framework_test_utils.go @@ -6,18 +6,12 @@ import ( "context" "fmt" "log" - "reflect" - "regexp" - "strings" "testing" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - - "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" ) func GetFwTestProvider(t *testing.T) *frameworkTestProvider { @@ -81,48 +75,3 @@ func testStringValue(sPtr *string) string { return *sPtr } - -// This function isn't a test of transport.go; instead, it is used as an alternative -// to ReplaceVars inside tests. -func ReplaceVarsForFrameworkTest(prov *fwtransport.FrameworkProviderConfig, rs *terraform.ResourceState, linkTmpl string) (string, error) { - re := regexp.MustCompile("{{([[:word:]]+)}}") - var project, region, zone string - - if strings.Contains(linkTmpl, "{{project}}") { - project = rs.Primary.Attributes["project"] - } - - if strings.Contains(linkTmpl, "{{region}}") { - region = tpgresource.GetResourceNameFromSelfLink(rs.Primary.Attributes["region"]) - } - - if strings.Contains(linkTmpl, "{{zone}}") { - zone = tpgresource.GetResourceNameFromSelfLink(rs.Primary.Attributes["zone"]) - } - - replaceFunc := func(s string) string { - m := re.FindStringSubmatch(s)[1] - if m == "project" { - return project - } - if m == "region" { - return region - } - if m == "zone" { - return zone - } - - if v, ok := rs.Primary.Attributes[m]; ok { - return v - } - - // Attempt to draw values from the provider - if f := reflect.Indirect(reflect.ValueOf(prov)).FieldByName(m); f.IsValid() { - return f.String() - } - - return "" - } - - return re.ReplaceAllStringFunc(linkTmpl, replaceFunc), nil -} diff --git a/google-beta/acctest/test_utils.go b/google-beta/acctest/test_utils.go index 7ea1fb7b54..02784529f9 100644 --- a/google-beta/acctest/test_utils.go +++ b/google-beta/acctest/test_utils.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-mux/tf5muxserver" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/envvar" ) func CheckDataSourceStateMatchesResourceState(dataSourceName, resourceName string) func(*terraform.State) error { @@ -202,3 +203,56 @@ func CreateZIPArchiveForCloudFunctionSource(t *testing.T, sourcePath string) str } return tmpfile.Name() } + +// providerConfigEnvNames returns a list of all the environment variables that could be set by a user to configure the provider +func providerConfigEnvNames() []string { + + envs := []string{} + + // Use existing collections of ENV names + envVarsSets := [][]string{ + envvar.CredsEnvVars, // credentials field + envvar.ProjectEnvVars, // project field + envvar.RegionEnvVars, //region field + envvar.ZoneEnvVars, // zone field + } + for _, set := range envVarsSets { + envs = append(envs, set...) + } + + // Add remaining ENVs + envs = append(envs, "GOOGLE_OAUTH_ACCESS_TOKEN") // access_token field + envs = append(envs, "GOOGLE_BILLING_PROJECT") // billing_project field + envs = append(envs, "GOOGLE_IMPERSONATE_SERVICE_ACCOUNT") // impersonate_service_account field + envs = append(envs, "USER_PROJECT_OVERRIDE") // user_project_override field + envs = append(envs, "CLOUDSDK_CORE_REQUEST_REASON") // request_reason field + + return envs +} + +// UnsetProviderConfigEnvs unsets any ENVs in the test environment that +// configure the provider. +// The testing package will restore the original values after the test +func UnsetTestProviderConfigEnvs(t *testing.T) { + envs := providerConfigEnvNames() + if len(envs) > 0 { + for _, k := range envs { + t.Setenv(k, "") + } + } +} + +func SetupTestEnvs(t *testing.T, envValues map[string]string) { + // Set ENVs + if len(envValues) > 0 { + for k, v := range envValues { + t.Setenv(k, v) + } + } +} + +// Returns a fake credentials JSON string with the client_email set to a test-specific value +func GenerateFakeCredentialsJson(testId string) string { + json := fmt.Sprintf(`{"private_key_id": "foo","private_key": "bar","client_email": "%s@example.com","client_id": "id@foo.com","type": "service_account"}`, testId) + return json +} diff --git a/google-beta/fwprovider/framework_provider_test.go b/google-beta/fwprovider/framework_provider_test.go index 69eb9fe863..f55237707a 100644 --- a/google-beta/fwprovider/framework_provider_test.go +++ b/google-beta/fwprovider/framework_provider_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwresource" "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport" "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" @@ -223,7 +224,7 @@ func testAccCheckDNSManagedZoneDestroyProducerFramework(t *testing.T) func(s *te p := acctest.GetFwTestProvider(t) - url, err := acctest.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") + url, err := fwresource.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } diff --git a/google-beta/fwresource/field_helpers.go b/google-beta/fwresource/field_helpers.go index b7d420f963..2d8476eac5 100644 --- a/google-beta/fwresource/field_helpers.go +++ b/google-beta/fwresource/field_helpers.go @@ -4,10 +4,14 @@ package fwresource import ( "fmt" + "reflect" "regexp" + "strings" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport" "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" ) @@ -64,3 +68,48 @@ func ParseProjectFieldValueFramework(resourceType, fieldValue, projectSchemaFiel ResourceType: resourceType, } } + +// This function isn't a test of transport.go; instead, it is used as an alternative +// to ReplaceVars inside tests. +func ReplaceVarsForFrameworkTest(prov *fwtransport.FrameworkProviderConfig, rs *terraform.ResourceState, linkTmpl string) (string, error) { + re := regexp.MustCompile("{{([[:word:]]+)}}") + var project, region, zone string + + if strings.Contains(linkTmpl, "{{project}}") { + project = rs.Primary.Attributes["project"] + } + + if strings.Contains(linkTmpl, "{{region}}") { + region = tpgresource.GetResourceNameFromSelfLink(rs.Primary.Attributes["region"]) + } + + if strings.Contains(linkTmpl, "{{zone}}") { + zone = tpgresource.GetResourceNameFromSelfLink(rs.Primary.Attributes["zone"]) + } + + replaceFunc := func(s string) string { + m := re.FindStringSubmatch(s)[1] + if m == "project" { + return project + } + if m == "region" { + return region + } + if m == "zone" { + return zone + } + + if v, ok := rs.Primary.Attributes[m]; ok { + return v + } + + // Attempt to draw values from the provider + if f := reflect.Indirect(reflect.ValueOf(prov)).FieldByName(m); f.IsValid() { + return f.String() + } + + return "" + } + + return re.ReplaceAllStringFunc(linkTmpl, replaceFunc), nil +} diff --git a/google-beta/provider/provider_internal_test.go b/google-beta/provider/provider_internal_test.go index fb77ee5a64..ede79e494c 100644 --- a/google-beta/provider/provider_internal_test.go +++ b/google-beta/provider/provider_internal_test.go @@ -5,11 +5,10 @@ package provider_test import ( "context" "errors" - "fmt" "os" "testing" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/envvar" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" "github.com/hashicorp/terraform-provider-google-beta/google-beta/provider" "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" @@ -85,59 +84,6 @@ func TestProvider_ValidateCredentials(t *testing.T) { } } -// ProviderConfigEnvNames returns a list of all the environment variables that could be set by a user to configure the provider -func ProviderConfigEnvNames() []string { - - envs := []string{} - - // Use existing collections of ENV names - envVarsSets := [][]string{ - envvar.CredsEnvVars, // credentials field - envvar.ProjectEnvVars, // project field - envvar.RegionEnvVars, //region field - envvar.ZoneEnvVars, // zone field - } - for _, set := range envVarsSets { - envs = append(envs, set...) - } - - // Add remaining ENVs - envs = append(envs, "GOOGLE_OAUTH_ACCESS_TOKEN") // access_token field - envs = append(envs, "GOOGLE_BILLING_PROJECT") // billing_project field - envs = append(envs, "GOOGLE_IMPERSONATE_SERVICE_ACCOUNT") // impersonate_service_account field - envs = append(envs, "USER_PROJECT_OVERRIDE") // user_project_override field - envs = append(envs, "CLOUDSDK_CORE_REQUEST_REASON") // request_reason field - - return envs -} - -// unsetProviderConfigEnvs unsets any ENVs in the test environment that -// configure the provider. -// The testing package will restore the original values after the test -func unsetTestProviderConfigEnvs(t *testing.T) { - envs := ProviderConfigEnvNames() - if len(envs) > 0 { - for _, k := range envs { - t.Setenv(k, "") - } - } -} - -func setupTestEnvs(t *testing.T, envValues map[string]string) { - // Set ENVs - if len(envValues) > 0 { - for k, v := range envValues { - t.Setenv(k, v) - } - } -} - -// Returns a fake credentials JSON string with the client_email set to a test-specific value -func generateFakeCredentialsJson(testId string) string { - json := fmt.Sprintf(`{"private_key_id": "foo","private_key": "bar","client_email": "%s@example.com","client_id": "id@foo.com","type": "service_account"}`, testId) - return json -} - func TestProvider_ProviderConfigure_credentials(t *testing.T) { const pathToMissingFile string = "./this/path/doesnt/exist.json" // Doesn't exist @@ -168,46 +114,46 @@ func TestProvider_ProviderConfigure_credentials(t *testing.T) { }, "credentials set in the config are not overridden by environment variables": { ConfigValues: map[string]interface{}{ - "credentials": generateFakeCredentialsJson("test"), + "credentials": acctest.GenerateFakeCredentialsJson("test"), }, EnvVariables: map[string]string{ - "GOOGLE_CREDENTIALS": generateFakeCredentialsJson("GOOGLE_CREDENTIALS"), - "GOOGLE_CLOUD_KEYFILE_JSON": generateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), - "GCLOUD_KEYFILE_JSON": generateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), - "GOOGLE_APPLICATION_CREDENTIALS": generateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), + "GOOGLE_CREDENTIALS": acctest.GenerateFakeCredentialsJson("GOOGLE_CREDENTIALS"), + "GOOGLE_CLOUD_KEYFILE_JSON": acctest.GenerateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), + "GCLOUD_KEYFILE_JSON": acctest.GenerateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), + "GOOGLE_APPLICATION_CREDENTIALS": acctest.GenerateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), }, - ExpectedSchemaValue: generateFakeCredentialsJson("test"), - ExpectedConfigValue: generateFakeCredentialsJson("test"), + ExpectedSchemaValue: acctest.GenerateFakeCredentialsJson("test"), + ExpectedConfigValue: acctest.GenerateFakeCredentialsJson("test"), }, "when credentials is unset in the config, environment variables are used: GOOGLE_CREDENTIALS used first": { EnvVariables: map[string]string{ - "GOOGLE_CREDENTIALS": generateFakeCredentialsJson("GOOGLE_CREDENTIALS"), - "GOOGLE_CLOUD_KEYFILE_JSON": generateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), - "GCLOUD_KEYFILE_JSON": generateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), - "GOOGLE_APPLICATION_CREDENTIALS": generateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), + "GOOGLE_CREDENTIALS": acctest.GenerateFakeCredentialsJson("GOOGLE_CREDENTIALS"), + "GOOGLE_CLOUD_KEYFILE_JSON": acctest.GenerateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), + "GCLOUD_KEYFILE_JSON": acctest.GenerateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), + "GOOGLE_APPLICATION_CREDENTIALS": acctest.GenerateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), }, ExpectedSchemaValue: "", - ExpectedConfigValue: generateFakeCredentialsJson("GOOGLE_CREDENTIALS"), + ExpectedConfigValue: acctest.GenerateFakeCredentialsJson("GOOGLE_CREDENTIALS"), }, "when credentials is unset in the config, environment variables are used: GOOGLE_CLOUD_KEYFILE_JSON used second": { EnvVariables: map[string]string{ // GOOGLE_CREDENTIALS not set - "GOOGLE_CLOUD_KEYFILE_JSON": generateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), - "GCLOUD_KEYFILE_JSON": generateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), - "GOOGLE_APPLICATION_CREDENTIALS": generateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), + "GOOGLE_CLOUD_KEYFILE_JSON": acctest.GenerateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), + "GCLOUD_KEYFILE_JSON": acctest.GenerateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), + "GOOGLE_APPLICATION_CREDENTIALS": acctest.GenerateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), }, ExpectedSchemaValue: "", - ExpectedConfigValue: generateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), + ExpectedConfigValue: acctest.GenerateFakeCredentialsJson("GOOGLE_CLOUD_KEYFILE_JSON"), }, "when credentials is unset in the config, environment variables are used: GCLOUD_KEYFILE_JSON used third": { EnvVariables: map[string]string{ // GOOGLE_CREDENTIALS not set // GOOGLE_CLOUD_KEYFILE_JSON not set - "GCLOUD_KEYFILE_JSON": generateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), - "GOOGLE_APPLICATION_CREDENTIALS": generateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), + "GCLOUD_KEYFILE_JSON": acctest.GenerateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), + "GOOGLE_APPLICATION_CREDENTIALS": acctest.GenerateFakeCredentialsJson("GOOGLE_APPLICATION_CREDENTIALS"), }, ExpectedSchemaValue: "", - ExpectedConfigValue: generateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), + ExpectedConfigValue: acctest.GenerateFakeCredentialsJson("GCLOUD_KEYFILE_JSON"), }, "when credentials is unset in the config (and access_token unset), GOOGLE_APPLICATION_CREDENTIALS is used for auth but not to set values in the config": { EnvVariables: map[string]string{ @@ -253,8 +199,8 @@ func TestProvider_ProviderConfigure_credentials(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -373,8 +319,8 @@ func TestProvider_ProviderConfigure_accessToken(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -475,8 +421,8 @@ func TestProvider_ProviderConfigure_impersonateServiceAccount(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -571,8 +517,8 @@ func TestProvider_ProviderConfigure_impersonateServiceAccountDelegates(t *testin // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -735,8 +681,8 @@ func TestProvider_ProviderConfigure_project(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -846,8 +792,8 @@ func TestProvider_ProviderConfigure_billingProject(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -971,8 +917,8 @@ func TestProvider_ProviderConfigure_region(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -1124,8 +1070,8 @@ func TestProvider_ProviderConfigure_zone(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -1252,8 +1198,8 @@ func TestProvider_ProviderConfigure_userProjectOverride(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) @@ -1354,8 +1300,8 @@ func TestProvider_ProviderConfigure_scopes(t *testing.T) { // Arrange ctx := context.Background() - unsetTestProviderConfigEnvs(t) - setupTestEnvs(t, tc.EnvVariables) + acctest.UnsetTestProviderConfigEnvs(t) + acctest.SetupTestEnvs(t, tc.EnvVariables) p := provider.Provider() d := tpgresource.SetupTestResourceDataFromConfigMap(t, p.Schema, tc.ConfigValues) diff --git a/google-beta/services/dns/data_source_dns_managed_zone_test.go b/google-beta/services/dns/data_source_dns_managed_zone_test.go index 3b592d8f60..aa0510ec89 100644 --- a/google-beta/services/dns/data_source_dns_managed_zone_test.go +++ b/google-beta/services/dns/data_source_dns_managed_zone_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwresource" "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport" ) @@ -101,7 +102,7 @@ func testAccCheckDNSManagedZoneDestroyProducerFramework(t *testing.T) func(s *te p := acctest.GetFwTestProvider(t) - url, err := acctest.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") + url, err := fwresource.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{name}}") if err != nil { return err } diff --git a/google-beta/services/dns/data_source_dns_record_set_test.go b/google-beta/services/dns/data_source_dns_record_set_test.go index 3b4db37b9f..7c7dc3d790 100644 --- a/google-beta/services/dns/data_source_dns_record_set_test.go +++ b/google-beta/services/dns/data_source_dns_record_set_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwresource" "github.com/hashicorp/terraform-provider-google-beta/google-beta/fwtransport" ) @@ -91,7 +92,7 @@ func testAccCheckDnsRecordSetDestroyProducerFramework(t *testing.T) func(s *terr p := acctest.GetFwTestProvider(t) - url, err := acctest.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{managed_zone}}/rrsets/{{name}}/{{type}}") + url, err := fwresource.ReplaceVarsForFrameworkTest(&p.FrameworkProvider.FrameworkProviderConfig, rs, "{{DNSBasePath}}projects/{{project}}/managedZones/{{managed_zone}}/rrsets/{{name}}/{{type}}") if err != nil { return err }