-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
AB #10674
base: main
Are you sure you want to change the base?
AB #10674
Conversation
} | ||
tblConf.AutomatedBackupConfig = &bigtable.TableAutomatedBackupPolicy{ | ||
RetentionPeriod: abpRetentionPeriod, | ||
Frequency: abpFrequency} |
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.
this looks like weird formatting. I'd have abpFrequency, and } on a new line
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.
Thanks, updated
Type: schema.TypeString, | ||
Optional: true, | ||
ValidateFunc: verify.ValidateDuration(), | ||
Description: `How long the automated backups should be retained. The only supported value at this time is 3 days.`, |
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.
That's a server side validation, right? We should remember to edit this text when we change the server side validation
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.
Thanks. That's right. To simplify future updates, I've removed the reference to particular values here
Type: schema.TypeString, | ||
Optional: true, | ||
ValidateFunc: verify.ValidateDuration(), | ||
Description: `How frequently automated backups should occur. The only supported value at this time is 24 hours.`, |
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.
same as above
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.
Thanks. That's right. To simplify future updates, I've removed the reference to particular values here
"frequency": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
ValidateFunc: verify.ValidateDuration(), |
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.
how does the validation work?
For garbage collection policy, we created a new~ ParseDuration function that can handled weeks (I think only weeks? maybe more). Do we want to use that one instead of the time.ParseDuration? If so, I'm not sure what ValidateDuration does, but maybe we want to do the same for the validation (it'd be weird if it didn't pass validation, but was valid everywhere else...)
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.
Thanks
I'm reusing the same verify.ValidateDuration
that change_stream_retention
above uses (which also parses using time.ParseDuration
) https://github.com/ma-g-22/magic-modules/blob/ab/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table.go#L103
Is this the new ParseDuration
function? https://github.com/ma-g-22/magic-modules/blob/ab/mmv1/third_party/terraform/services/bigtable/duration_parsing_helper.go#L26 - I could change it to use this, though I'm not sure if we need weeks specifically?
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.
That's the difference between these two. I am not sure how critical it is for your use case, but there is nothing to lose by moving to it (I am pretty sure of that, at least. Best to make sure with some manual\automatic tests)
Type: schema.TypeString, | ||
Optional: true, | ||
ValidateFunc: verify.ValidateDuration(), | ||
Description: `How long the automated backups should be retained. The only supported value at this time is 3 days.`, |
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.
Shall we also mention that "set to 0 to disable"? Same thing for frequency
.
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.
Discussed offline, per https://docs.google.com/document/d/1NzFf9Fi3MLJFG4sZgeVhbxMlxbKumF7xPQ1U3mgquJs we are not doing 0 to disable.
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.
Thanks. On further thought, I believe we should continue with 0-to-disable
I've updated the code here
I've also posted a PR here: googleapis/google-cloud-go#10226
@@ -335,6 +401,36 @@ func resourceBigtableTableUpdate(d *schema.ResourceData, meta interface{}) error | |||
} | |||
} | |||
|
|||
if d.HasChange("automated_backup_policy") { | |||
abpField := d.Get("automated_backup_policy") | |||
if abpField == nil { |
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 probably got confused about what we decided, I thought we want to follow CDC and disable when retention_period and frequency is set as 0, and no change if automated_backup_policy is null.
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.
Discussed offline, this is implementing the right behavior defined in https://docs.google.com/document/d/1NzFf9Fi3MLJFG4sZgeVhbxMlxbKumF7xPQ1U3mgquJs, i.e. nill to disable.
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.
Thanks. On further thought, I believe we should continue with 0-to-disable
I've updated the code here
I've also posted a PR here: googleapis/google-cloud-go#10226
@@ -418,6 +489,35 @@ func testAccBigtableChangeStreamDisabled(t *testing.T) resource.TestCheckFunc { | |||
} | |||
} | |||
|
|||
func testAccBigtableAutomatedBackupsDisabled(t *testing.T) resource.TestCheckFunc { |
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.
test or Test? Seems inconsistent?
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.
Thanks. I've renamed this to verifyBigtableAutomatedBackupsDisabled
to reduce confusion. This is not a test per-se, but a verification function used as part of the TestAccBigtableTable_automated_backups_enable
test
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @trodge, 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. |
This PR has been waiting for review for 2 weekdays. Please take a look! Use the label |
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
|
/gcbrun |
If this PR is for Terraform, I acknowledge that I have:
Release Note Template for Downstream PRs (will be copied)