From 76266f3031921166eb0b9a9598bf611ee6160621 Mon Sep 17 00:00:00 2001 From: ibhaskar2 Date: Thu, 7 Sep 2023 07:28:13 +0000 Subject: [PATCH 1/7] Added documentation for cloud sql instance edition --- cloud_sql/instance_edition | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 cloud_sql/instance_edition diff --git a/cloud_sql/instance_edition b/cloud_sql/instance_edition new file mode 100644 index 000000000..94add6ec5 --- /dev/null +++ b/cloud_sql/instance_edition @@ -0,0 +1,40 @@ +/** + * 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_enterprise_plus_instance] +resource "google_sql_database_instance" "enterprise_plus_instance" { + name = "enterprise-plus-mysql-instance" + region = "us-central1" + database_version = "POSTGRES_15" + settings { + tier = "db-perf-optimized-N-96" + edition = "ENTERPRISE_PLUS" + } + deletion_protection = false +} +# [END cloud_sql_enterprise_plus_instance] + +# [START cloud_sql_enterprise_instance] +resource "google_sql_database_instance" "enterprise_instance" { + name = "enterprise-postgres-instance" + region = "us-central1" + database_version = "POSTGRES_15" + settings { + tier = "db-g1-small" + } + deletion_protection = "false" +} +# [END cloud_sql_enterprise_instance] \ No newline at end of file From 332dd6814af7aa33668686fcd2469ea86d201883 Mon Sep 17 00:00:00 2001 From: ibhaskar2 Date: Thu, 7 Sep 2023 07:56:38 +0000 Subject: [PATCH 2/7] Fixed formatting with terraform fmt --- cloud_sql/instance_edition | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloud_sql/instance_edition b/cloud_sql/instance_edition index 94add6ec5..9b6ece02c 100644 --- a/cloud_sql/instance_edition +++ b/cloud_sql/instance_edition @@ -16,11 +16,11 @@ # [START cloud_sql_enterprise_plus_instance] resource "google_sql_database_instance" "enterprise_plus_instance" { - name = "enterprise-plus-mysql-instance" + name = "enterprise-plus-mysql-instance" region = "us-central1" - database_version = "POSTGRES_15" + database_version = "POSTGRES_15" settings { - tier = "db-perf-optimized-N-96" + tier = "db-perf-optimized-N-96" edition = "ENTERPRISE_PLUS" } deletion_protection = false @@ -35,6 +35,6 @@ resource "google_sql_database_instance" "enterprise_instance" { settings { tier = "db-g1-small" } - deletion_protection = "false" + deletion_protection = "false" } # [END cloud_sql_enterprise_instance] \ No newline at end of file From 08ae23ddbe2d08e29d0a2ad81dd202b1fe9d98ff Mon Sep 17 00:00:00 2001 From: Ishant Bhaskar <68506858+ibhaskar2@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:52:54 +0530 Subject: [PATCH 3/7] Update instance_edition --- cloud_sql/instance_edition | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_sql/instance_edition b/cloud_sql/instance_edition index 9b6ece02c..3f2e21d9c 100644 --- a/cloud_sql/instance_edition +++ b/cloud_sql/instance_edition @@ -37,4 +37,4 @@ resource "google_sql_database_instance" "enterprise_instance" { } deletion_protection = "false" } -# [END cloud_sql_enterprise_instance] \ No newline at end of file +# [END cloud_sql_enterprise_instance] From 61ba75182bae5e19c414d6f35304381cfa1a15e0 Mon Sep 17 00:00:00 2001 From: ibhaskar2 Date: Wed, 13 Sep 2023 08:35:54 +0000 Subject: [PATCH 4/7] Split the samples in two sepreate files, rename resource names as per https://cloud.google.com/docs/terraform/best-practices-for-terraform --- cloud_sql/enterprise_edition_instance/main.tf | 28 +++++++++++++++++++ .../main.tf} | 16 ++--------- 2 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 cloud_sql/enterprise_edition_instance/main.tf rename cloud_sql/{instance_edition => enterprise_plus_edition_instance/main.tf} (65%) diff --git a/cloud_sql/enterprise_edition_instance/main.tf b/cloud_sql/enterprise_edition_instance/main.tf new file mode 100644 index 000000000..064e59cdc --- /dev/null +++ b/cloud_sql/enterprise_edition_instance/main.tf @@ -0,0 +1,28 @@ +/** + * 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_enterprise_instance] +resource "google_sql_database_instance" "main" { + name = "enterprise-postgres-instance" + region = "us-central1" + database_version = "POSTGRES_15" + settings { + tier = "db-g1-small" + } + deletion_protection = "false" +} +# [END cloud_sql_enterprise_instance] diff --git a/cloud_sql/instance_edition b/cloud_sql/enterprise_plus_edition_instance/main.tf similarity index 65% rename from cloud_sql/instance_edition rename to cloud_sql/enterprise_plus_edition_instance/main.tf index 3f2e21d9c..b9565da7e 100644 --- a/cloud_sql/instance_edition +++ b/cloud_sql/enterprise_plus_edition_instance/main.tf @@ -15,8 +15,8 @@ */ # [START cloud_sql_enterprise_plus_instance] -resource "google_sql_database_instance" "enterprise_plus_instance" { - name = "enterprise-plus-mysql-instance" +resource "google_sql_database_instance" "main" { + name = "enterprise_plus_instance" region = "us-central1" database_version = "POSTGRES_15" settings { @@ -26,15 +26,3 @@ resource "google_sql_database_instance" "enterprise_plus_instance" { deletion_protection = false } # [END cloud_sql_enterprise_plus_instance] - -# [START cloud_sql_enterprise_instance] -resource "google_sql_database_instance" "enterprise_instance" { - name = "enterprise-postgres-instance" - region = "us-central1" - database_version = "POSTGRES_15" - settings { - tier = "db-g1-small" - } - deletion_protection = "false" -} -# [END cloud_sql_enterprise_instance] From 451c4eda0f7238b2aefc1f88102bf1d82ca4f6a8 Mon Sep 17 00:00:00 2001 From: ibhaskar2 Date: Wed, 13 Sep 2023 08:39:56 +0000 Subject: [PATCH 5/7] Fixed name --- cloud_sql/enterprise_edition_instance/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_sql/enterprise_edition_instance/main.tf b/cloud_sql/enterprise_edition_instance/main.tf index 064e59cdc..ff90b31d6 100644 --- a/cloud_sql/enterprise_edition_instance/main.tf +++ b/cloud_sql/enterprise_edition_instance/main.tf @@ -17,7 +17,7 @@ # [START cloud_sql_enterprise_instance] resource "google_sql_database_instance" "main" { - name = "enterprise-postgres-instance" + name = "enterprise-instance" region = "us-central1" database_version = "POSTGRES_15" settings { From c160da857c20d561f0ad41ed1c09d793f89bb57d Mon Sep 17 00:00:00 2001 From: ibhaskar2 Date: Mon, 18 Sep 2023 19:41:12 +0000 Subject: [PATCH 6/7] Renamed folders with database prefix --- .../main.tf | 2 +- .../main.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename cloud_sql/{enterprise_edition_instance => postgres_enterprise_edition_instance}/main.tf (94%) rename cloud_sql/{enterprise_plus_edition_instance => postgres_enterprise_plus_edition_instance}/main.tf (94%) diff --git a/cloud_sql/enterprise_edition_instance/main.tf b/cloud_sql/postgres_enterprise_edition_instance/main.tf similarity index 94% rename from cloud_sql/enterprise_edition_instance/main.tf rename to cloud_sql/postgres_enterprise_edition_instance/main.tf index ff90b31d6..809a72395 100644 --- a/cloud_sql/enterprise_edition_instance/main.tf +++ b/cloud_sql/postgres_enterprise_edition_instance/main.tf @@ -16,7 +16,7 @@ # [START cloud_sql_enterprise_instance] -resource "google_sql_database_instance" "main" { +resource "google_sql_database_instance" "default" { name = "enterprise-instance" region = "us-central1" database_version = "POSTGRES_15" diff --git a/cloud_sql/enterprise_plus_edition_instance/main.tf b/cloud_sql/postgres_enterprise_plus_edition_instance/main.tf similarity index 94% rename from cloud_sql/enterprise_plus_edition_instance/main.tf rename to cloud_sql/postgres_enterprise_plus_edition_instance/main.tf index b9565da7e..8f82ab806 100644 --- a/cloud_sql/enterprise_plus_edition_instance/main.tf +++ b/cloud_sql/postgres_enterprise_plus_edition_instance/main.tf @@ -15,7 +15,7 @@ */ # [START cloud_sql_enterprise_plus_instance] -resource "google_sql_database_instance" "main" { +resource "google_sql_database_instance" "default" { name = "enterprise_plus_instance" region = "us-central1" database_version = "POSTGRES_15" From ef1d205a459f203ca9f1f1b7ffa2296dd6a188ef Mon Sep 17 00:00:00 2001 From: Roger Martinez <31829545+rogerthatdev@users.noreply.github.com> Date: Wed, 27 Sep 2023 15:41:49 -0700 Subject: [PATCH 7/7] fix: replace `_` with `-` in instance name --- cloud_sql/postgres_enterprise_plus_edition_instance/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud_sql/postgres_enterprise_plus_edition_instance/main.tf b/cloud_sql/postgres_enterprise_plus_edition_instance/main.tf index 8f82ab806..49a8ccea9 100644 --- a/cloud_sql/postgres_enterprise_plus_edition_instance/main.tf +++ b/cloud_sql/postgres_enterprise_plus_edition_instance/main.tf @@ -16,7 +16,7 @@ # [START cloud_sql_enterprise_plus_instance] resource "google_sql_database_instance" "default" { - name = "enterprise_plus_instance" + name = "enterprise-plus-instance" region = "us-central1" database_version = "POSTGRES_15" settings {