-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Bigtable: Update local gc_rules on read #6526
Bigtable: Update local gc_rules on read #6526
Conversation
Hello! I am a robot who works on Magic Modules PRs. I've detected that you're a community contributor. @slevenick, a repository maintainer, has been assigned to assist you and help review your changes. ❓ First time contributing? Click here for more detailsYour assigned reviewer will help review your code by:
You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails. If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox. |
@hoangpham95 Please take a look. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 196 insertions(+), 14 deletions(-)) |
mmv1/third_party/terraform/resources/resource_bigtable_gc_policy.go
Outdated
Show resolved
Hide resolved
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeForwardingRule_update|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 202 insertions(+), 17 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccFirebaserulesRelease_BasicRelease|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
mmv1/third_party/terraform/resources/resource_bigtable_gc_policy.go
Outdated
Show resolved
Hide resolved
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 204 insertions(+), 17 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccComputeInstance_soleTenantNodeAffinities|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccFirebaserulesRelease_BasicRelease |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
FYI. I also tested this PR locally in KCC and I have verified that this fixes the drift issue stated in b/230626815. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 210 insertions(+), 17 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccComputeInstance_soleTenantNodeAffinities|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
Hi Sam. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not seeing this track changes quite right. Are you sure that changes are being detected and resolved on the gc_rules field itself?
I have a config of:
resource "google_bigtable_gc_policy" "policy" {
instance_name = google_bigtable_instance.instance.id
table = google_bigtable_table.table.name
column_family = "some-column"
provider = google-beta
gc_rules = "{\"rules\":[{\"max_age\":\"10h\"},{\"max_version\":3}], \"mode\":\"intersection\"}"
}
I manually go update the maxNumVersions via the console to be 4, the API starts returning:
"gcRule": {
"intersection": {
"rules": [
{
"maxAge": "36000s"
},
{
"maxNumVersions": 4
}
]
}
}
And Terraform only sees a diff on the ID field which it ignores:
# google_bigtable_gc_policy.policy has changed
~ resource "google_bigtable_gc_policy" "policy" {
~ id = "(age() > 10h && versions() > 3)" -> "(age() > 10h && versions() > 4)"
# (5 unchanged attributes hidden)
}
See the comment I posted earlier. With this PR:
We are seeing diff because we are reading the remote gc policy back now. I believe we have to modify the gc_rules in both the config and the state file, then TF can detect the change. I don't fully understand this; I suspect that this has to do with GC policy doesn't support import. |
Sam, I did you said earlier (modify the resource resource), I did get the correct diff in gc_rules (not just the id). Terraform will perform the following actions:
|
Currently when GCPolicy remote resource is updated not on TF (Pantheon, gcloud CLI, etc.), the gc_rules string are not updated on read. This PR fixes the issue by parsing the GC policy into JSON string that TF understands and set it in the local gc_rules. This hopefully will resolve the drift issue we have seen in KCC.
The original PR: #6415 was created by hoangpham95.
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)