From b5c64679c489bd660151e98499019ff03f7d8422 Mon Sep 17 00:00:00 2001 From: Jiongxin Ye Date: Wed, 10 Sep 2025 14:20:57 -0700 Subject: [PATCH 1/4] Add Terraform sample for cloud sql final backup config --- cloud_sql/mysql_instance_final_backup/main.tf | 31 +++++++++++++++++++ .../mysql_instance_final_backup/test.yaml | 20 ++++++++++++ .../postgres_instance_final_backup/main.tf | 0 .../postgres_instance_final_backup/test.yaml | 20 ++++++++++++ .../sqlserver_instance_final_backup/main.tf | 31 +++++++++++++++++++ .../sqlserver_instance_final_backup/test.yaml | 20 ++++++++++++ 6 files changed, 122 insertions(+) create mode 100644 cloud_sql/mysql_instance_final_backup/main.tf create mode 100644 cloud_sql/mysql_instance_final_backup/test.yaml create mode 100644 cloud_sql/postgres_instance_final_backup/main.tf create mode 100644 cloud_sql/postgres_instance_final_backup/test.yaml create mode 100644 cloud_sql/sqlserver_instance_final_backup/main.tf create mode 100644 cloud_sql/sqlserver_instance_final_backup/test.yaml diff --git a/cloud_sql/mysql_instance_final_backup/main.tf b/cloud_sql/mysql_instance_final_backup/main.tf new file mode 100644 index 000000000..e1d69c7a9 --- /dev/null +++ b/cloud_sql/mysql_instance_final_backup/main.tf @@ -0,0 +1,31 @@ +/** + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +# [START cloud_sql_mysql_instance_final_backup] +resource "google_sql_database_instance" "default" { + name = "mysql-instance-final-backup" + region = "asia-northeast1" + database_version = "MYSQL_8_0" + settings { + tier = "db-f1-micro" + final_backup_config { + enabled = true + retention_days = 10 + } + } + final_backup_description = "TF Sample final backup description" +} +# [END cloud_sql_mysql_instance_final_backup] \ No newline at end of file diff --git a/cloud_sql/mysql_instance_final_backup/test.yaml b/cloud_sql/mysql_instance_final_backup/test.yaml new file mode 100644 index 000000000..645f64205 --- /dev/null +++ b/cloud_sql/mysql_instance_final_backup/test.yaml @@ -0,0 +1,20 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: blueprints.cloud.google.com/v1alpha1 +kind: BlueprintTest +metadata: + name: sql_mysql_instance_final_backup +spec: + skip: true \ No newline at end of file diff --git a/cloud_sql/postgres_instance_final_backup/main.tf b/cloud_sql/postgres_instance_final_backup/main.tf new file mode 100644 index 000000000..e69de29bb diff --git a/cloud_sql/postgres_instance_final_backup/test.yaml b/cloud_sql/postgres_instance_final_backup/test.yaml new file mode 100644 index 000000000..8c146507e --- /dev/null +++ b/cloud_sql/postgres_instance_final_backup/test.yaml @@ -0,0 +1,20 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: blueprints.cloud.google.com/v1alpha1 +kind: BlueprintTest +metadata: + name: sql_postgres_instance_final_backup +spec: + skip: true \ No newline at end of file diff --git a/cloud_sql/sqlserver_instance_final_backup/main.tf b/cloud_sql/sqlserver_instance_final_backup/main.tf new file mode 100644 index 000000000..ed6b8812e --- /dev/null +++ b/cloud_sql/sqlserver_instance_final_backup/main.tf @@ -0,0 +1,31 @@ +/** + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +# [START cloud_sql_sqlserver_instance_final_backup] +resource "google_sql_database_instance" "default" { + name = "sqlserver-instance-final-backup" + region = "us-central1" + database_version = "SQLSERVER_2019_STANDARD" + settings { + tier = "db-f1-micro" + final_backup_config { + enabled = true + retention_days = 10 + } + } + final_backup_description = "TF Sample final backup description" +} +# [END cloud_sql_sqlserver_instance_final_backup] \ No newline at end of file diff --git a/cloud_sql/sqlserver_instance_final_backup/test.yaml b/cloud_sql/sqlserver_instance_final_backup/test.yaml new file mode 100644 index 000000000..6b457c351 --- /dev/null +++ b/cloud_sql/sqlserver_instance_final_backup/test.yaml @@ -0,0 +1,20 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: blueprints.cloud.google.com/v1alpha1 +kind: BlueprintTest +metadata: + name: sql_sqlserver_instance_final_backup +spec: + skip: true \ No newline at end of file From 549b1eecbcf6b620ea40b39cadb08b33f17d81dc Mon Sep 17 00:00:00 2001 From: Jiongxin Ye Date: Thu, 11 Sep 2025 10:56:23 -0700 Subject: [PATCH 2/4] Add postgres tag --- .../postgres_instance_final_backup/main.tf | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cloud_sql/postgres_instance_final_backup/main.tf b/cloud_sql/postgres_instance_final_backup/main.tf index e69de29bb..471f8ca25 100644 --- a/cloud_sql/postgres_instance_final_backup/main.tf +++ b/cloud_sql/postgres_instance_final_backup/main.tf @@ -0,0 +1,31 @@ +/** + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +# [START cloud_sql_postgres_instance_final_backup] +resource "google_sql_database_instance" "default" { + name = "postgres-instance-final-backup" + region = "us-central1" + database_version = "POSTGRES_14" + settings { + tier = "db-f1-micro" + final_backup_config { + enabled = true + retention_days = 10 + } + } + final_backup_description = "TF Sample final backup description" +} +# [END cloud_sql_postgres_instance_final_backup] \ No newline at end of file From a840c45e9058519108969236cc97c1abac303eca Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 16 Sep 2025 07:07:50 +1000 Subject: [PATCH 3/4] lint --- cloud_sql/mysql_instance_final_backup/main.tf | 2 +- cloud_sql/mysql_instance_final_backup/test.yaml | 2 +- cloud_sql/postgres_instance_final_backup/main.tf | 2 +- cloud_sql/postgres_instance_final_backup/test.yaml | 2 +- cloud_sql/sqlserver_instance_final_backup/main.tf | 2 +- cloud_sql/sqlserver_instance_final_backup/test.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cloud_sql/mysql_instance_final_backup/main.tf b/cloud_sql/mysql_instance_final_backup/main.tf index e1d69c7a9..806af73fe 100644 --- a/cloud_sql/mysql_instance_final_backup/main.tf +++ b/cloud_sql/mysql_instance_final_backup/main.tf @@ -28,4 +28,4 @@ resource "google_sql_database_instance" "default" { } final_backup_description = "TF Sample final backup description" } -# [END cloud_sql_mysql_instance_final_backup] \ No newline at end of file +# [END cloud_sql_mysql_instance_final_backup] diff --git a/cloud_sql/mysql_instance_final_backup/test.yaml b/cloud_sql/mysql_instance_final_backup/test.yaml index 645f64205..ed0aef472 100644 --- a/cloud_sql/mysql_instance_final_backup/test.yaml +++ b/cloud_sql/mysql_instance_final_backup/test.yaml @@ -17,4 +17,4 @@ kind: BlueprintTest metadata: name: sql_mysql_instance_final_backup spec: - skip: true \ No newline at end of file + skip: true diff --git a/cloud_sql/postgres_instance_final_backup/main.tf b/cloud_sql/postgres_instance_final_backup/main.tf index 471f8ca25..d8bf19e9a 100644 --- a/cloud_sql/postgres_instance_final_backup/main.tf +++ b/cloud_sql/postgres_instance_final_backup/main.tf @@ -28,4 +28,4 @@ resource "google_sql_database_instance" "default" { } final_backup_description = "TF Sample final backup description" } -# [END cloud_sql_postgres_instance_final_backup] \ No newline at end of file +# [END cloud_sql_postgres_instance_final_backup] diff --git a/cloud_sql/postgres_instance_final_backup/test.yaml b/cloud_sql/postgres_instance_final_backup/test.yaml index 8c146507e..0086e848e 100644 --- a/cloud_sql/postgres_instance_final_backup/test.yaml +++ b/cloud_sql/postgres_instance_final_backup/test.yaml @@ -17,4 +17,4 @@ kind: BlueprintTest metadata: name: sql_postgres_instance_final_backup spec: - skip: true \ No newline at end of file + skip: true diff --git a/cloud_sql/sqlserver_instance_final_backup/main.tf b/cloud_sql/sqlserver_instance_final_backup/main.tf index ed6b8812e..f5500e102 100644 --- a/cloud_sql/sqlserver_instance_final_backup/main.tf +++ b/cloud_sql/sqlserver_instance_final_backup/main.tf @@ -28,4 +28,4 @@ resource "google_sql_database_instance" "default" { } final_backup_description = "TF Sample final backup description" } -# [END cloud_sql_sqlserver_instance_final_backup] \ No newline at end of file +# [END cloud_sql_sqlserver_instance_final_backup] diff --git a/cloud_sql/sqlserver_instance_final_backup/test.yaml b/cloud_sql/sqlserver_instance_final_backup/test.yaml index 6b457c351..584037e5b 100644 --- a/cloud_sql/sqlserver_instance_final_backup/test.yaml +++ b/cloud_sql/sqlserver_instance_final_backup/test.yaml @@ -17,4 +17,4 @@ kind: BlueprintTest metadata: name: sql_sqlserver_instance_final_backup spec: - skip: true \ No newline at end of file + skip: true From d21dfd6fde134c65eb068dde3c6983ce05ba8000 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Tue, 16 Sep 2025 07:50:00 +1000 Subject: [PATCH 4/4] Update copyright to current year --- cloud_sql/mysql_instance_final_backup/main.tf | 2 +- cloud_sql/mysql_instance_final_backup/test.yaml | 2 +- cloud_sql/postgres_instance_final_backup/main.tf | 2 +- cloud_sql/postgres_instance_final_backup/test.yaml | 2 +- cloud_sql/sqlserver_instance_final_backup/main.tf | 2 +- cloud_sql/sqlserver_instance_final_backup/test.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cloud_sql/mysql_instance_final_backup/main.tf b/cloud_sql/mysql_instance_final_backup/main.tf index 806af73fe..0c7a20057 100644 --- a/cloud_sql/mysql_instance_final_backup/main.tf +++ b/cloud_sql/mysql_instance_final_backup/main.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cloud_sql/mysql_instance_final_backup/test.yaml b/cloud_sql/mysql_instance_final_backup/test.yaml index ed0aef472..c230939af 100644 --- a/cloud_sql/mysql_instance_final_backup/test.yaml +++ b/cloud_sql/mysql_instance_final_backup/test.yaml @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cloud_sql/postgres_instance_final_backup/main.tf b/cloud_sql/postgres_instance_final_backup/main.tf index d8bf19e9a..bbffdfa5e 100644 --- a/cloud_sql/postgres_instance_final_backup/main.tf +++ b/cloud_sql/postgres_instance_final_backup/main.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cloud_sql/postgres_instance_final_backup/test.yaml b/cloud_sql/postgres_instance_final_backup/test.yaml index 0086e848e..dd67adc99 100644 --- a/cloud_sql/postgres_instance_final_backup/test.yaml +++ b/cloud_sql/postgres_instance_final_backup/test.yaml @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cloud_sql/sqlserver_instance_final_backup/main.tf b/cloud_sql/sqlserver_instance_final_backup/main.tf index f5500e102..308ddd6b3 100644 --- a/cloud_sql/sqlserver_instance_final_backup/main.tf +++ b/cloud_sql/sqlserver_instance_final_backup/main.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cloud_sql/sqlserver_instance_final_backup/test.yaml b/cloud_sql/sqlserver_instance_final_backup/test.yaml index 584037e5b..1075d89b0 100644 --- a/cloud_sql/sqlserver_instance_final_backup/test.yaml +++ b/cloud_sql/sqlserver_instance_final_backup/test.yaml @@ -1,4 +1,4 @@ -# Copyright 2022 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.