Skip to content

Terraform changes for enabling cross project clone#16541

Open
gsa725 wants to merge 28 commits intoGoogleCloudPlatform:mainfrom
gsa725:CpcTfChanges
Open

Terraform changes for enabling cross project clone#16541
gsa725 wants to merge 28 commits intoGoogleCloudPlatform:mainfrom
gsa725:CpcTfChanges

Conversation

@gsa725
Copy link

@gsa725 gsa725 commented Feb 26, 2026

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

sql: added `clone_context.source_project` field to `google_sql_database_instance` resource to support cross project clone (beta)

@github-actions
Copy link

github-actions bot commented Feb 26, 2026

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@NickElliot, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 152 insertions(+), 13 deletions(-))
google-beta provider: Diff ( 4 files changed, 152 insertions(+), 13 deletions(-))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 0
Passed tests: 0
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages

All service packages are affected

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@NickElliot
Copy link
Contributor

@modular-magician reassign-reviewer @NickElliot

@github-actions github-actions bot requested review from NickElliot and removed request for malhotrasagar2212 February 26, 2026 18:28
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 163 insertions(+), 15 deletions(-))
google-beta provider: Diff ( 4 files changed, 163 insertions(+), 15 deletions(-))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 0
Passed tests: 0
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages

All service packages are affected

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 163 insertions(+), 15 deletions(-))
google-beta provider: Diff ( 4 files changed, 163 insertions(+), 15 deletions(-))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 0
Passed tests: 0
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages

All service packages are affected

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 174 insertions(+), 15 deletions(-))
google-beta provider: Diff ( 4 files changed, 174 insertions(+), 15 deletions(-))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 0
Passed tests: 0
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages

All service packages are affected

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 171 insertions(+), 15 deletions(-))
google-beta provider: Diff ( 4 files changed, 171 insertions(+), 15 deletions(-))

Errors

google provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

google-beta provider:

  • The diff processor failed to build. This is usually due to the downstream provider failing to compile.

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 0
Passed tests: 0
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages

All service packages are affected

🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR.

View the build log

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 171 insertions(+), 15 deletions(-))
google-beta provider: Diff ( 4 files changed, 171 insertions(+), 15 deletions(-))

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_sql_database_instance
    • Expected Document Path: /website/docs/r/sql_database_instance.html.markdown
    • Fields: [clone.source_project]

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 167 insertions(+), 14 deletions(-))
google-beta provider: Diff ( 4 files changed, 167 insertions(+), 14 deletions(-))

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_sql_database_instance
    • Expected Document Path: /website/docs/r/sql_database_instance.html.markdown
    • Fields: [clone.source_project]

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 168 insertions(+), 14 deletions(-))
google-beta provider: Diff ( 5 files changed, 168 insertions(+), 14 deletions(-))

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_sql_database_instance
    • Expected Document Path: /website/docs/r/sql_database_instance.html.markdown
    • Fields: [clone.source_project]

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 6092
Passed tests: 5449
Skipped tests: 639
Affected tests: 4

Click here to see the affected service packages

All service packages are affected

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 6093
Passed tests: 5450
Skipped tests: 639
Affected tests: 4

Click here to see the affected service packages

All service packages are affected

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🔴 Tests failed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController [Error message] [Debug log]
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls [Error message] [Debug log]
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🔴 Tests failed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController [Error message] [Debug log]
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls [Error message] [Debug log]
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 6093
Passed tests: 5450
Skipped tests: 639
Affected tests: 4

Click here to see the affected service packages

All service packages are affected

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🔴 Tests failed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController [Error message] [Debug log]
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls [Error message] [Debug log]
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 6120
Passed tests: 5476
Skipped tests: 638
Affected tests: 6

Click here to see the affected service packages

All service packages are affected

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDataformConfig_dataformConfigWithKmsKeyExample
  • TestAccDataformConfig_update
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccSqlDatabaseInstance_crossProjectClone
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 6120
Passed tests: 5475
Skipped tests: 638
Affected tests: 7

Click here to see the affected service packages

All service packages are affected

Action taken

Found 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccContainerNodePool_withHugepageConfig
  • TestAccDataformConfig_dataformConfigWithKmsKeyExample
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccObservabilityOrganizationSettings_datasource
  • TestAccSqlDatabaseInstance_crossProjectClone
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccContainerNodePool_withHugepageConfig [Debug log]
TestAccDataformConfig_dataformConfigWithKmsKeyExample [Debug log]
TestAccObservabilityOrganizationSettings_datasource [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]
TestAccSqlDatabaseInstance_crossProjectClone [Error message] [Debug log]
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls [Error message] [Debug log]
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

}

func testAccSqlDatabaseInstance_crossProjectClone(context map[string]interface{}) string {
return acctest.Nprintf(`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provider = google-beta is needed for each resource and data source.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project = "${data.google_project.source_project.project_id}"
}

//data "google_compute_network" "servicenet" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clean up the code block

@github-actions github-actions bot requested a review from zli82016 March 5, 2026 07:11
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 109 insertions(+), 10 deletions(-))
google-beta provider: Diff ( 5 files changed, 155 insertions(+), 10 deletions(-))

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_sql_database_instance
    • Expected Document Path: /website/docs/r/sql_database_instance.html.markdown
    • Fields: [clone.source_project]

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 109 insertions(+), 10 deletions(-))
google-beta provider: Diff ( 5 files changed, 155 insertions(+), 10 deletions(-))

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_sql_database_instance
    • Expected Document Path: /website/docs/r/sql_database_instance.html.markdown
    • Fields: [clone.source_project]

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 6129
Passed tests: 5487
Skipped tests: 637
Affected tests: 5

Click here to see the affected service packages

All service packages are affected

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDataformConfig_dataformConfigWithKmsKeyExample
  • TestAccDataformConfig_update
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 6129
Passed tests: 5489
Skipped tests: 637
Affected tests: 3

Click here to see the affected service packages

All service packages are affected

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDataformConfig_dataformConfigWithKmsKeyExample [Debug log]
TestAccDataformConfig_update [Debug log]
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccDataformConfig_dataformConfigWithKmsKeyExample [Error message] [Debug log]
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🔴 Tests failed during RECORDING mode:
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls [Error message] [Debug log]
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Debug log]

🔴 Tests failed when rerunning REPLAYING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]

Tests failed due to non-determinism or randomness when the VCR replayed the response after the HTTP request was made.

Please fix these to complete your PR. If you believe these test failures to be incorrect or unrelated to your change, or if you have any questions, please raise the concern with your reviewer.


🔴 Tests failed during RECORDING mode:
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls [Error message] [Debug log]
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Mar 5, 2026
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 109 insertions(+), 10 deletions(-))
google-beta provider: Diff ( 5 files changed, 155 insertions(+), 10 deletions(-))

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_sql_database_instance
    • Expected Document Path: /website/docs/r/sql_database_instance.html.markdown
    • Fields: [clone.source_project]

@zli82016
Copy link
Member

zli82016 commented Mar 5, 2026

/gcbrun

@modular-magician modular-magician added awaiting-approval Pull requests that need reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Mar 5, 2026
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 109 insertions(+), 10 deletions(-))
google-beta provider: Diff ( 5 files changed, 155 insertions(+), 10 deletions(-))

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_sql_database_instance
    • Expected Document Path: /website/docs/r/sql_database_instance.html.markdown
    • Fields: [clone.source_project]

Copy link
Member

@zli82016 zli82016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. A new destination project is created in the test. The dedicated destination project is not needed.
  2. Fix the failed tests. The existing tests are broken in this PR.
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone
  1. Revert the changes in file
mmv1/third_party/terraform/acctest/bootstrap_test_utils.go.tmpl
mmv1/third_party/terraform/envvar/envvar_utils.go
  1. Add the new field source_project to the doc file https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown?plain=1#L715
  2. Address all comments in the PR
  3. Make sure all tests related to sql pass

project_id = "%{cloneDestinationProject}"
}
resource "google_sql_database_instance" "instance" {
name = "tf-test-cpc-%{random_suffix}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provider = google-beta is needed for each resource and data source.

func TestAccSqlDatabaseInstance_crossProjectClone(t *testing.T) {
t.Parallel()

cloneDestinationProject := envvar.GetTestDestinationProjectFromEnv(t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use a new project for the destination project and the test TestAccSqlDatabaseInstance_crossProjectClone passed.
Please reference the PR #16620

That means the dedicated destination project is not needed.
Please let me know if there are any questions.


context := map[string]interface{}{
"random_suffix": acctest.RandString(t, 10),
"original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t, cloneSourceProject),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original_db_name is not needed, as the source instance can be created with the config in the test.

"random_suffix": acctest.RandString(t, 10),
"original_db_name": acctest.BootstrapSharedSQLInstanceBackupRun(t, cloneSourceProject),
"cloneSourceProject": cloneSourceProject,
"cloneDestinationProject": cloneDestinationProject,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cloneDestinationProject is not needed.

// Returns the name of a network, creating it if it hasn't been created in the
// test project.
func BootstrapSharedTestNetwork(t *testing.T, testId string) string {
func BootstrapSharedTestNetwork(t *testing.T, testId string, project_id ...string) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert any changes in this file.

"CLOUDSDK_CORE_PROJECT",
}

var cloneProjectEnvVars = []string{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not needed.

return transport_tpg.MultiEnvSearch(vmwareengineProjectEnvVars)
}

func GetTestDestinationProjectFromEnv(t *testing.T) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not needed.

Comment on lines +1638 to +1639
cloneContext.DestinationProject = project
cloneContext.DestinationNetwork = network
Copy link
Member

@zli82016 zli82016 Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests (e.g. TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls) failed with the error message

        Error: Error, failed to create instance tf-test-ch29qff66h-clone1: googleapi: Error 400: Request contains an invalid argument., badRequest
        
          with google_sql_database_instance.clone1,
          on terraform_plugin_test.tf line 25, in resource "google_sql_database_instance" "clone1":
          25: resource "google_sql_database_instance" "clone1" {

Does it need to check cloneSourceProject when adding these fields?

@modular-magician
Copy link
Collaborator

Non-exercised tests

🔴 Tests were added that are skipped in VCR:

  • TestAccSqlDatabaseInstance_crossProjectClone

Tests analytics

Total tests: 6133
Passed tests: 5492
Skipped tests: 637
Affected tests: 4

Click here to see the affected service packages

All service packages are affected

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDataformConfig_update
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
  • TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDataformConfig_update [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls [Error message] [Debug log]
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants