Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle unsetting policy tags in BigQuery table schema #8658

Merged
merged 3 commits into from
Aug 17, 2023

Conversation

wj-chen
Copy link
Member

@wj-chen wj-chen commented Aug 15, 2023

Fixes hashicorp/terraform-provider-google#14047.

Now all of 1) no policyTags, 2) policyTags = {}, and 3) policyTags = { names = [] } in schema will remove any existing policyTags setting on the designated table column, and no longer generate a permadiff after the removal is applied.

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

bigquery: added support to unset policy tags in table schema

@modular-magician
Copy link
Collaborator

Hello! I am a robot. It looks like you are a: Community Contributor Googler Core Contributor. Tests will run automatically.

@c2thorn, 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.

Terraform GA: Diff ( 2 files changed, 268 insertions(+))
Terraform Beta: Diff ( 2 files changed, 268 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2955
Passed tests 2612
Skipped tests: 302
Affected tests: 41

Action taken

Found 41 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccBigQueryJob_bigqueryJobExtractExample|TestAccBigQueryTableIamBindingGenerated_withCondition|TestAccBigQueryJob_bigqueryJobExtractTableReferenceExample|TestAccBigQueryTableIamPolicyGenerated_withCondition|TestAccBigQueryJob_bigqueryJobCopyTableReferenceExample|TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTagNames|TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTag|TestAccBigQueryTable_Update_SchemaWithPolicyTagsToNoPolicyTag|TestAccBigQueryTable_Update_SchemaWithoutPolicyTagsToWithPolicyTags|TestAccBigQueryJob_bigqueryJobCopyExample|TestAccBigQueryTableIamPolicyGenerated|TestAccBigQueryTableIamMemberGenerated|TestAccBigQueryTableIamBindingGenerated|TestAccBigQueryTable_allowDestroy|TestAccBigQueryExternalDataTable_parquetOptions|TestAccBigQueryDataTable_expandArray|TestAccBigQueryDataTable_canReorderParameters|TestAccBigQueryDataTable_jsonEquivalency|TestAccBigQueryDataTable_sheet|TestAccBigQueryExternalDataTable_CSV_WithSchema_UpdateAllowQuotedNewlines|TestAccBigQueryExternalDataTable_CSV_WithSchema_UpdateToConnectionID|TestAccBigQueryTable_HivePartitioningCustomSchema|TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Update|TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Basic|TestAccBigQueryTable_WithViewAndSchema|TestAccBigQueryExternalDataTable_CSV_WithSchemaAndConnectionID_UpdateNoConnectionID|TestAccBigQueryTable_RangePartitioning|TestAccBigQueryExternalDataTable_json|TestAccBigQueryTable_YearlyTimePartitioning|TestAccBigQueryTableIamMemberGenerated_withCondition|TestAccBigQueryTable_MonthlyTimePartitioning|TestAccBigQueryTable_Kms|TestAccBigQueryTable_HourlyTimePartitioning|TestAccBigQueryTable_Basic|TestAccBigQueryExternalDataTable_CSV|TestAccBigQueryTable_updateView|TestAccDataLossPreventionJobTrigger_dlpJobTriggerChangingActions|TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyUpdate|TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyExample|TestAccPubsubSubscription_pubsubSubscriptionPushBqExample|TestAccDataSourceGoogleServiceAccountIdToken_impersonation

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBigQueryJob_bigqueryJobExtractExample[Debug log]
TestAccBigQueryJob_bigqueryJobExtractTableReferenceExample[Debug log]
TestAccBigQueryJob_bigqueryJobCopyTableReferenceExample[Debug log]
TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTagNames[Debug log]
TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTag[Debug log]
TestAccBigQueryTable_Update_SchemaWithPolicyTagsToNoPolicyTag[Debug log]
TestAccBigQueryTable_Update_SchemaWithoutPolicyTagsToWithPolicyTags[Debug log]
TestAccBigQueryJob_bigqueryJobCopyExample[Debug log]
TestAccBigQueryTable_allowDestroy[Debug log]
TestAccBigQueryExternalDataTable_parquetOptions[Debug log]
TestAccBigQueryDataTable_expandArray[Debug log]
TestAccBigQueryDataTable_canReorderParameters[Debug log]
TestAccBigQueryDataTable_jsonEquivalency[Debug log]
TestAccBigQueryDataTable_sheet[Debug log]
TestAccBigQueryExternalDataTable_CSV_WithSchema_UpdateAllowQuotedNewlines[Debug log]
TestAccBigQueryExternalDataTable_CSV_WithSchema_UpdateToConnectionID[Debug log]
TestAccBigQueryTable_HivePartitioningCustomSchema[Debug log]
TestAccBigQueryTable_WithViewAndSchema[Debug log]
TestAccBigQueryExternalDataTable_CSV_WithSchemaAndConnectionID_UpdateNoConnectionID[Debug log]
TestAccBigQueryTable_RangePartitioning[Debug log]
TestAccBigQueryExternalDataTable_json[Debug log]
TestAccBigQueryExternalDataTable_CSV[Debug log]
TestAccBigQueryTable_updateView[Debug log]
TestAccDataLossPreventionJobTrigger_dlpJobTriggerChangingActions[Debug log]
TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyUpdate[Debug log]
TestAccDataLossPreventionJobTrigger_dlpJobTriggerDeidentifyExample[Debug log]
TestAccPubsubSubscription_pubsubSubscriptionPushBqExample[Debug log]
TestAccDataSourceGoogleServiceAccountIdToken_impersonation[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccBigQueryTableIamBindingGenerated_withCondition[Error message] [Debug log]
TestAccBigQueryTableIamPolicyGenerated_withCondition[Error message] [Debug log]
TestAccBigQueryTableIamPolicyGenerated[Error message] [Debug log]
TestAccBigQueryTableIamMemberGenerated[Error message] [Debug log]
TestAccBigQueryTableIamBindingGenerated[Error message] [Debug log]
TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Update[Error message] [Debug log]
TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Basic[Error message] [Debug log]
TestAccBigQueryTable_YearlyTimePartitioning[Error message] [Debug log]
TestAccBigQueryTableIamMemberGenerated_withCondition[Error message] [Debug log]
TestAccBigQueryTable_MonthlyTimePartitioning[Error message] [Debug log]
TestAccBigQueryTable_Kms[Error message] [Debug log]
TestAccBigQueryTable_HourlyTimePartitioning[Error message] [Debug log]
TestAccBigQueryTable_Basic[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@wj-chen
Copy link
Member Author

wj-chen commented Aug 15, 2023

Will look into test failures and update here once resolved.

@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.

Terraform GA: Diff ( 2 files changed, 319 insertions(+), 3 deletions(-))
Terraform Beta: Diff ( 2 files changed, 319 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2965
Passed tests 2643
Skipped tests: 302
Affected tests: 20

Action taken

Found 20 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccBigQueryTable_YearlyTimePartitioning|TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Update|TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Basic|TestAccBigQueryTable_Basic|TestAccBigQueryTable_Kms|TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTag|TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTagNames|TestAccBigQueryTable_Update_SchemaWithPolicyTagsToNoPolicyTag|TestAccBigQueryTable_updateView|TestAccBigQueryTable_MonthlyTimePartitioning|TestAccBigQueryTable_Update_SchemaWithoutPolicyTagsToWithPolicyTags|TestAccBigQueryTable_HourlyTimePartitioning|TestAccBigQueryTable_WithViewAndSchema|TestAccBigQueryTableIamPolicyGenerated_withCondition|TestAccBigQueryTableIamMemberGenerated_withCondition|TestAccBigQueryTableIamBindingGenerated|TestAccBigQueryTableIamPolicyGenerated|TestAccBigQueryTableIamBindingGenerated_withCondition|TestAccBigQueryTableIamMemberGenerated|TestAccSpannerDatabaseIamPolicy

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccBigQueryTable_YearlyTimePartitioning[Debug log]
TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Update[Debug log]
TestAccBigQueryTable_MaterializedView_DailyTimePartioning_Basic[Debug log]
TestAccBigQueryTable_Basic[Debug log]
TestAccBigQueryTable_Kms[Debug log]
TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTag[Debug log]
TestAccBigQueryTable_Update_SchemaWithPolicyTagsToEmptyPolicyTagNames[Debug log]
TestAccBigQueryTable_Update_SchemaWithPolicyTagsToNoPolicyTag[Debug log]
TestAccBigQueryTable_updateView[Debug log]
TestAccBigQueryTable_MonthlyTimePartitioning[Debug log]
TestAccBigQueryTable_Update_SchemaWithoutPolicyTagsToWithPolicyTags[Debug log]
TestAccBigQueryTable_HourlyTimePartitioning[Debug log]
TestAccBigQueryTable_WithViewAndSchema[Debug log]
TestAccBigQueryTableIamPolicyGenerated_withCondition[Debug log]
TestAccBigQueryTableIamMemberGenerated_withCondition[Debug log]
TestAccBigQueryTableIamBindingGenerated[Debug log]
TestAccBigQueryTableIamPolicyGenerated[Debug log]
TestAccBigQueryTableIamBindingGenerated_withCondition[Debug log]
TestAccBigQueryTableIamMemberGenerated[Debug log]
TestAccSpannerDatabaseIamPolicy[Debug log]

Rerun these tests in REPLAYING mode to catch issues

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$
View the build log or the debug log for each test

@wj-chen
Copy link
Member Author

wj-chen commented Aug 17, 2023

Will look into test failures and update here once resolved.

All checks passed after the new commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform doesn't apply changes when removing data masking policy tag from google_bigquery_table.
3 participants