Add delete_protection to SQL Instances + Service Networking Pre Create Checks#3954
Conversation
|
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. Thanks for your contribution! A human will be with you soon. @ndmckinley, please review this PR or find an appropriate assignee. |
|
So, tests are failing for the deletion_protection but the service networking check is passing. The other test is complaining of non empty plan but my approach is similar to #3450 so not sure what is going on.
|
|
Were you able to figure out the |
|
/gcbrun |
|
Yeah, still looks good on my end. I'm running the affected integration tests on our CI now. |
|
Almost there! You didn't update the regex for your error checker in the integration test: |
|
Ah, this also breaks all the other SQL tests, because it introduces a permadiff - if deletion_protection is unset, it will always show a diff. |
|
:( I have updated the regex, any ideas on the permadiff? |
|
Aha. I think it's probably an odd manifestation of the fact that you have the type set to TypeString when it should be a boolean. |
1 similar comment
nat-henderson
left a comment
There was a problem hiding this comment.
Looks good, running the tests again now.
|
Okay, all the integration tests still fail with |
danawillow
left a comment
There was a problem hiding this comment.
Apologies for the detailed drive-by- I happened to notice this PR and since I wrote the other deletion_protection one, I have some Opinions on what the right approach is :)
There was a problem hiding this comment.
How useful is this field with a false default? The reason why we added it to bigtable was to prevent people from accidentally destroying their instances because they didn't realize they should do a lifecycle prevent_destroy. If the default is false, wouldn't that just be equivalent to the prevent_destroy behavior?
There was a problem hiding this comment.
I didn't consider that. I assumed that the users would set this true if they wanted to avoid terraform deleting their data. I never understood how the OP in 7072 blindly ran a plan that marked the instance for destruction and asked for more guardrails.
I'll set it to true.
There was a problem hiding this comment.
In fairness, Google doesn't stop the instance from being deleted if a database already exists on it which is strange considering Google requires dependant resource to be deleted before the parent resource is deleted. ie DNS Records in DNS Zones, VPC Networks, GCE Disk, etc
There was a problem hiding this comment.
This change is completely unrelated to the deletion protection one. In the future, changes like these two should be in separate PRs so they can be easily reviewed independently.
|
Rerunning the tests now. |
|
The following tests still fail: As well as two that are already failing: |
|
I forgot about the other resources linked to it. I'll push a commit now |
|
I think i got them all |
|
Okay, I will run the tests overnight. |
nat-henderson
left a comment
There was a problem hiding this comment.
Tests all pass. I updated the release notes as well.
nat-henderson
left a comment
There was a problem hiding this comment.
Ah, one last thing:
==> Checking source code against linters...
google/resource_sql_database_instance.go:1062:7: Error return value of `d.Set` is not checked (errcheck)
d.Set("deletion_protection", true)
^
make: *** [lint] Error 1
|
it is fixed now |
|
@danawillow - are your requested changes made? GH wants all reviewers to approve before submitting - can you approve or dismiss your review if we're good to merge? :) |
danawillow
left a comment
There was a problem hiding this comment.
FYI I updated the changelog message to use the correct resource and field names.
|
I think we are ready to go. |
|
Not sure what changed, but |
|
something snuck in when i merged master in to the branch, i'll fix it now |
|
i think we are good now. 😌 |
Fixes: hashicorp/terraform-provider-google#7072
Fixes: hashicorp/terraform-provider-google#7154
If this PR is for Terraform, I acknowledge that I have:
make testandmake lintto ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)