Terraform changes for enabling cross project clone#16541
Terraform changes for enabling cross project clone#16541gsa725 wants to merge 28 commits intoGoogleCloudPlatform:mainfrom
Conversation
|
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. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Errors
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 0 Click here to see the affected service packages
🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR. View the build log |
|
@modular-magician reassign-reviewer @NickElliot |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Errors
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 0 Click here to see the affected service packages
🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR. View the build log |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Errors
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 0 Click here to see the affected service packages
🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR. View the build log |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Errors
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 0 Click here to see the affected service packages
🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR. View the build log |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Errors
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 0 Click here to see the affected service packages
🔴 Errors occurred during REPLAYING mode. Please fix them to complete your PR. View the build log |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing doc report (experimental)The following resources have fields missing in documents.
|
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing doc report (experimental)The following resources have fields missing in documents.
|
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing doc report (experimental)The following resources have fields missing in documents.
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 6092 Click here to see the affected service packages
Action takenFound 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 6093 Click here to see the affected service packages
Action takenFound 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🔴 Tests failed when rerunning REPLAYING mode: 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: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
|
🟢 Tests passed during RECORDING mode: 🔴 Tests failed when rerunning REPLAYING mode: 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: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 6093 Click here to see the affected service packages
Action takenFound 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🔴 Tests failed when rerunning REPLAYING mode: 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: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
Tests analyticsTotal tests: 6120 Click here to see the affected service packages
Action takenFound 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
Tests analyticsTotal tests: 6120 Click here to see the affected service packages
Action takenFound 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🟢 No issues found for passed tests after REPLAYING rerun. 🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
| } | ||
|
|
||
| func testAccSqlDatabaseInstance_crossProjectClone(context map[string]interface{}) string { | ||
| return acctest.Nprintf(` |
There was a problem hiding this comment.
provider = google-beta is needed for each resource and data source.
There was a problem hiding this comment.
| project = "${data.google_project.source_project.project_id}" | ||
| } | ||
|
|
||
| //data "google_compute_network" "servicenet" { |
mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go.tmpl
Outdated
Show resolved
Hide resolved
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing doc report (experimental)The following resources have fields missing in documents.
|
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing doc report (experimental)The following resources have fields missing in documents.
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 6129 Click here to see the affected service packages
Action takenFound 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 6129 Click here to see the affected service packages
Action takenFound 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🔴 Tests failed when rerunning REPLAYING mode: 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: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
|
🟢 Tests passed during RECORDING mode: 🔴 Tests failed when rerunning REPLAYING mode: 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: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing doc report (experimental)The following resources have fields missing in documents.
|
|
/gcbrun |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing doc report (experimental)The following resources have fields missing in documents.
|
There was a problem hiding this comment.
- A new destination project is created in the test. The dedicated destination project is not needed.
- Fix the failed tests. The existing tests are broken in this PR.
TestAccSqlDatabaseInstance_deleteDefaultUserBeforeSubsequentApiCalls
TestAccSqlDatabaseInstance_withPrivateNetwork_withAllocatedIpRangeClone
- Revert the changes in file
mmv1/third_party/terraform/acctest/bootstrap_test_utils.go.tmpl
mmv1/third_party/terraform/envvar/envvar_utils.go
- Add the new field
source_projectto the doc filehttps://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown?plain=1#L715 - Address all comments in the PR
- Make sure all tests related to sql pass
| project_id = "%{cloneDestinationProject}" | ||
| } | ||
| resource "google_sql_database_instance" "instance" { | ||
| name = "tf-test-cpc-%{random_suffix}" |
There was a problem hiding this comment.
provider = google-beta is needed for each resource and data source.
| func TestAccSqlDatabaseInstance_crossProjectClone(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| cloneDestinationProject := envvar.GetTestDestinationProjectFromEnv(t) |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Please revert any changes in this file.
| "CLOUDSDK_CORE_PROJECT", | ||
| } | ||
|
|
||
| var cloneProjectEnvVars = []string{ |
| return transport_tpg.MultiEnvSearch(vmwareengineProjectEnvVars) | ||
| } | ||
|
|
||
| func GetTestDestinationProjectFromEnv(t *testing.T) string { |
| cloneContext.DestinationProject = project | ||
| cloneContext.DestinationNetwork = network |
There was a problem hiding this comment.
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?
Non-exercised tests🔴 Tests were added that are skipped in VCR:
Tests analyticsTotal tests: 6133 Click here to see the affected service packages
Action takenFound 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
|
🟢 Tests passed during RECORDING mode: 🟢 No issues found for passed tests after REPLAYING rerun. 🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.