From 931670a86e0726fef94dac793c7e9413fda57a24 Mon Sep 17 00:00:00 2001 From: AshishGoogle Date: Wed, 22 May 2024 13:43:20 -0700 Subject: [PATCH] Adding support for week5 maintenance update track (#10732) Co-authored-by: Ashish Jindal --- .../sql/resource_sql_database_instance.go.erb | 2 +- .../resource_sql_database_instance_test.go | 43 +++++++++++++++++++ .../r/sql_database_instance.html.markdown | 3 +- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb index 93614f156d62..47d160befc20 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb @@ -549,7 +549,7 @@ is set to true. Defaults to ZONAL.`, Type: schema.TypeString, Optional: true, AtLeastOneOf: maintenanceWindowKeys, - Description: `Receive updates earlier (canary) or later (stable)`, + Description: `Receive updates after one week (canary) or after two weeks (stable) or after five weeks (week5) of notification.`, }, }, }, diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go index e1026f891282..b99215e4db4b 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go @@ -559,6 +559,30 @@ func TestAccSqlDatabaseInstance_maintenance(t *testing.T) { }) } +func TestAccSqlDatabaseInstance_maintenance_update_track_week5(t *testing.T) { + t.Parallel() + + masterID := acctest.RandInt(t) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: fmt.Sprintf( + testGoogleSqlDatabaseInstance_maintenance_week5, masterID), + }, + { + ResourceName: "google_sql_database_instance.instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"deletion_protection"}, + }, + }, + }) +} + func TestAccSqlDatabaseInstance_settings_upgrade(t *testing.T) { t.Parallel() @@ -3632,6 +3656,25 @@ resource "google_sql_database_instance" "instance" { } ` +var testGoogleSqlDatabaseInstance_maintenance_week5 = ` +resource "google_sql_database_instance" "instance" { + name = "tf-test-%d" + region = "us-central1" + database_version = "MYSQL_5_7" + deletion_protection = false + + settings { + tier = "db-f1-micro" + + maintenance_window { + day = 7 + hour = 3 + update_track = "week5" + } + } +} +` + var testGoogleSqlDatabaseInstance_authNets_step1 = ` resource "google_sql_database_instance" "instance" { name = "tf-test-%d" diff --git a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown index df8d9ee0fc86..0be73458f650 100644 --- a/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/sql_database_instance.html.markdown @@ -419,8 +419,7 @@ when an Instance can automatically restart to apply updates. The maintenance win * `hour` - (Optional) Hour of day (`0-23`), ignored if `day` not set -* `update_track` - (Optional) Receive updates earlier (`canary`) or later -(`stable`) +* `update_track` - (Optional) Receive updates after one week (`canary`) or after two weeks (`stable`) or after five weeks (`week5`) of notification. The optional `settings.insights_config` subblock for instances declares Query Insights([MySQL](https://cloud.google.com/sql/docs/mysql/using-query-insights), [PostgreSQL](https://cloud.google.com/sql/docs/postgres/using-query-insights)) configuration. It contains: