-
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
Support Self Service Maintenance feature #6131
Conversation
Oops! It looks like you're using an unknown release-note type in your changelog entries:
Please only use the types listed in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md. |
Hello! I am a robot who works on Magic Modules PRs. I've detected that you're a community contributor. @shuyama1, 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. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 42 insertions(+), 3 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccContainerCluster_withConfidentialNodes|TestAccContainerCluster_withAddons|TestAccSqlUser_mysqlDisabled |
Question: Is |
That is correct! availabe_maintenance_versions can never be updated. maintenance_version field can be updated to any of versions specified in the available_maintenance_versions field. |
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.
Would you mind adding a test or modifying an existing test for these two added fields?
mmv1/products/sql/api.yaml
Outdated
@@ -68,6 +68,22 @@ objects: | |||
- :FIRST_GEN | |||
- :SECOND_GEN | |||
- :EXTERNAL | |||
- !ruby/object:Api::Type::String | |||
name: 'maintenanceVersion' | |||
output: true |
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.
Sounds like maintenanceVersion
is not an output-only field.
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 right. It can be updated after instance creation.
"available_maintenance_versions": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Optional: true, |
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.
If this is an output-only field, we probably want to remove Optional: true
.
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.
Done.
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 75 insertions(+), 3 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccPrivatecaCertificateAuthority_subordinateCaActivatedByFirstPartyIssuerOnCreation|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccSqlDatabaseInstance_maintenanceVersionWithOldVersion_suppressConfig|TestAccSqlDatabaseInstance_basicMSSQL|TestAccSqlDatabaseInstance_SqlServerAuditConfig |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
Hi shuyama1, I have addressed the changes that were requested. Please take another look. |
@2tricpony Thanks for making the update! Sorry for the delay. I'll start reviewing the PR. |
Gentle ping on this. :) |
@2tricpony Sorry, this fell off my radar. Thanks for the ping! |
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.
Based on the debug log, it seems that the maintenance_version
is not included in the request body even if we config it explicitly. Should it throw error if we set this field in the creation step (as we discussed offline)?
Also would you mind adding an update step for this feature? I understand that the it can not really update the resource(as the newly created instance should have the most recent version if I understand correctly), but we can just add it to check if it can be sent correctly via the API call. Many thanks! Let me know if you got any questions.
mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/tests/resource_sql_database_instance_test.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/resources/resource_sql_database_instance.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown
Outdated
Show resolved
Hide resolved
…e.html.markdown Co-authored-by: Shuya Ma <[email protected]>
…e.html.markdown Co-authored-by: Shuya Ma <[email protected]>
Tests failed during RECORDING mode: Please fix these to complete your PR |
resource.TestStep{ | ||
Config: fmt.Sprintf( | ||
testGoogleSqlDatabaseInstance_maintenanceVersionWithOldVersion, databaseName), | ||
}, | ||
resource.TestStep{ | ||
ResourceName: "google_sql_database_instance.instance", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"deletion_protection"}, | ||
}, |
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 believe this is a copy error and should be removed?
Added the suppressDiffFunc back. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 150 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
@@ -1428,6 +1477,16 @@ func resourceSqlDatabaseInstanceUpdate(d *schema.ResourceData, meta interface{}) | |||
return resourceSqlDatabaseInstanceRead(d, meta) | |||
} | |||
|
|||
func maintenanceVersionDiffSuppress(_, old, new string, _ *schema.ResourceData) bool { | |||
// Ignore the database version part and only compare the last part of the maintenance version which represents the release date of the version. | |||
if len(old) > 14 && len(new) > 14 && old[len(old)-14:] > new[len(new)-14:] { |
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.
Question: Do you think if we should suppress when old[len(old)-14:] = new[len(new)-14:]
?
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.
Good question. If the version is same, it's a no-op on the backend. Having said that, I think we can also suppress on Terraform side when it's equal. I have added that logic.
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 150 insertions(+), 2 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 |
Tests failed during RECORDING mode: Please fix these to complete your PR |
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.
Tested it locally and LGTM in general! Just some nitpicks on documentation. Also please rebase the PR if conflicts occur. Thank you!
mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown
Outdated
Show resolved
Hide resolved
Thank you for verifying! I have updated the PR and I didn't find any conflicts. |
mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown
Outdated
Show resolved
Hide resolved
…e.html.markdown Co-authored-by: Shuya Ma <[email protected]>
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 3 files changed, 150 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Action takenTriggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed testsTestAccFirebaserulesRelease_BasicRelease|TestAccComputeServiceAttachment_serviceAttachmentBasicExample|TestAccComputeVpnTunnel_regionFromGateway|TestAccComputePacketMirroring_computePacketMirroringFullExample|TestAccComputeRoute_routeIlbVipExample|TestAccComputeRoute_routeIlbExample|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccComputeGlobalForwardingRule_labels|TestAccComputeGlobalForwardingRule_ipv6|TestAccComputeGlobalForwardingRule_updateTarget|TestAccComputeGlobalForwardingRule_privateServiceConnectGoogleApisExample|TestAccComputeGlobalForwardingRule_globalForwardingRuleHybridExample|TestAccComputeGlobalForwardingRule_globalForwardingRuleInternalExample|TestAccComputeForwardingRule_serviceDirectoryRegistrations|TestAccComputeForwardingRule_update|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccComputeForwardingRule_internalHttpLbWithMigBackendExample |
Tests passed during RECORDING mode: Tests failed during RECORDING mode: Please fix these to complete your PR |
Support Self Service Maintenance feature. This adds support for 2 API fields - maintenance_version and available_maintenance_version. Fixes hashicorp/terraform-provider-google#11881
maintenance_version
feature summary:available_maintenance_version
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)