From b2d4ee225d42d8f9460a95fa23d3ec4332995932 Mon Sep 17 00:00:00 2001 From: Daniel Rieske Date: Tue, 15 Aug 2023 20:09:05 +0200 Subject: [PATCH] Added edition field to CloudSQL settings in DMS connection profile (#8602) * feat: added edition field to cloudsql settings * chore: formatted example file --- .../connectionprofile.yaml | 7 +++ ...service_connection_profile_cloudsql.tf.erb | 47 +++++++++---------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index 86351ff654be..3396127ae17b 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -479,6 +479,13 @@ properties: name: 'cmekKeyName' description: | The KMS key name used for the csql instance. + - !ruby/object:Api::Type::Enum + name: 'edition' + description: | + The edition of the given Cloud SQL instance. + values: + - :ENTERPRISE + - :ENTERPRISE_PLUS - !ruby/object:Api::Type::String name: 'privateIp' output: true diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.erb index d06ac4b57527..30f0fc7cb168 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.erb @@ -13,7 +13,7 @@ resource "google_sql_database_instance" "cloudsqldb" { resource "google_sql_ssl_cert" "sql_client_cert" { common_name = "<%= ctx[:vars]["sqldb_cert"] %>" - instance = google_sql_database_instance.cloudsqldb.name + instance = google_sql_database_instance.cloudsqldb.name depends_on = [google_sql_database_instance.cloudsqldb] } @@ -29,21 +29,21 @@ resource "google_sql_user" "sqldb_user" { resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { - location = "us-central1" + location = "us-central1" connection_profile_id = "<%= ctx[:vars]["from_profile"] %>" - display_name = "<%= ctx[:vars]["from_profile"] %>_display" + display_name = "<%= ctx[:vars]["from_profile"] %>_display" labels = { foo = "bar" } mysql { - host = google_sql_database_instance.cloudsqldb.ip_address.0.ip_address - port = 3306 + host = google_sql_database_instance.cloudsqldb.ip_address.0.ip_address + port = 3306 username = google_sql_user.sqldb_user.name password = google_sql_user.sqldb_user.password ssl { - client_key = google_sql_ssl_cert.sql_client_cert.private_key + client_key = google_sql_ssl_cert.sql_client_cert.private_key client_certificate = google_sql_ssl_cert.sql_client_cert.cert - ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert + ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert } cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" } @@ -53,9 +53,9 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>_destination" { - location = "us-central1" + location = "us-central1" connection_profile_id = "<%= ctx[:vars]["to_profile"] %>" - display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" + display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" labels = { foo = "bar" } @@ -65,22 +65,21 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar user_labels = { cloudfoo = "cloudbar" } - tier = "db-n1-standard-1" - storage_auto_resize_limit = "0" - activation_policy = "ALWAYS" - ip_config { - enable_ipv4 = true - require_ssl = "true" - } - auto_storage_increase = true - data_disk_type = "PD_HDD" - data_disk_size_gb = "11" - zone = "us-central1-b" - source_id = "projects/${data.google_project.project.project_id}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["from_profile"] %>" - root_password = "testpasscloudsql" + tier = "db-n1-standard-1" + edition = "ENTERPRISE" + storage_auto_resize_limit = "0" + activation_policy = "ALWAYS" + ip_config { + enable_ipv4 = true + require_ssl = true + } + auto_storage_increase = true + data_disk_type = "PD_HDD" + data_disk_size_gb = "11" + zone = "us-central1-b" + source_id = "projects/${data.google_project.project.project_id}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["from_profile"] %>" + root_password = "testpasscloudsql" } - - } depends_on = [google_database_migration_service_connection_profile.<%= ctx[:primary_resource_id] %>] }