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

fix google_bigquery_table encryption_configuration modifications #2880

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

MartinNowak
Copy link
Contributor

Release Note Template for Downstream PRs (will be copied)


@modular-magician
Copy link
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review. They will authorize it to run through our CI pipeline, which will generate downstream PRs.

Thanks for your contribution! A human will be with you soon.

@rambleraptor, please review this PR or find an appropriate assignee.

@slevenick
Copy link
Contributor

I'm not sure I'm convinced this is the best way to go here. I believe that technically this is the correct way to represent this in Terraform, because forcing a recreate is the only way to handle changes to encryption via the API.

What worries me is that we would be introducing a potentially dangerous data loss situation when someone attempts to add encryption to their bigquery table, losing any data that existed in the table.

I would almost prefer throwing an error when attempting to update the encryption config and point to the guide on copying & encrypting a table, but that's not very terraform-y

@emilymye thoughts?

@emilymye
Copy link
Contributor

I don't mind the more restrictive "encryption cannot be updated" approach for now, would be down with a customdiff.ValidateChange - if enough users hate it, we can switch to just allow ForceNew encryption. It doesn't hurt anyone who decided to do the more tedious copy-encryption, and I don't think anyone is updating their table encryption in an automated workflow.

@nat-henderson
Copy link
Contributor

We discussed this in a meeting and prefer the ForceNew approach for symmetry with our other data storage resources. This PR LGTM.

@nat-henderson nat-henderson self-requested a review January 6, 2020 19:17
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 75262f5.

Pull request statuses

No diff detected in terraform-google-conversion.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#1591
depends: hashicorp/terraform-provider-google#5321

- changing to/from CMEK requires recreating the table (see [Change a table from default encryption to Cloud KMS protection](https://cloud.google.com/bigquery/docs/customer-managed-encryption#change_to_kms))
- the BQ API appears to support the default -> kms transition (no API error), but tables don't appear to get encrypted according to the UI/CLI
- see hashicorp/terraform-provider-google#5241 and GoogleCloudPlatform#2763 (comment) for more info
@modular-magician modular-magician merged commit b9c5e5d into GoogleCloudPlatform:master Jan 6, 2020
@MartinNowak MartinNowak deleted the patch-12 branch January 10, 2020 15:53
@MartinNowak
Copy link
Contributor Author

Thanks for the thoughtful consideration, I agree with the consistency argument.
Data loss is indeed something to carefully watch out for with Terraform though. Some policy/config that prevents destruction of (certain) resources seems like a proper way to handle this. Maybe with a simpler approach than https://www.terraform.io/docs/cloud/sentinel/sentinel-tf-012.html though.

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.

6 participants