From 50c03a7d7465f0f209a6d210d0f3958119dd1742 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Wed, 1 Feb 2023 10:47:56 -0800 Subject: [PATCH 01/22] Implemented DBMS resource --- .../databasemigrationservice/api.yaml | 507 ++++++++++++++++++ 1 file changed, 507 insertions(+) create mode 100644 mmv1/products/databasemigrationservice/api.yaml diff --git a/mmv1/products/databasemigrationservice/api.yaml b/mmv1/products/databasemigrationservice/api.yaml new file mode 100644 index 000000000000..58d967cbfc0e --- /dev/null +++ b/mmv1/products/databasemigrationservice/api.yaml @@ -0,0 +1,507 @@ +# Copyright 2022 Google Inc. +# 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. + +--- +!ruby/object:Api::Product +name: DatabaseMigrationService +display_name: DatabaseMigrationService +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: https://datamigration.googleapis.com +scopes: + - https://www.googleapis.com/auth/cloud-platform +apis_required: + - !ruby/object:Api::Product::ApiReference + name: Database Migration API + url: https://console.cloud.google.com/apis/library/datamigration.googleapis.com +objects: + - !ruby/object:Api::Resource + name: "ConnectionProfile" + #self_link: "projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}" + #base_url: "projects/{{project}}/locations/{{location}}/connectionProfiles" + #create_url: "projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}" + #description: "A managed workstation cluster." + references: !ruby/object:Api::Resource::ReferenceLinks + guides: + # "Workstations": "https://cloud.google.com/database-migration/docs/" + # api: "https://cloud.google.com/workstations/docs/reference/rest/v1/projects.locations.connectionProfiles/create" + parameters: + # - !ruby/object:Api::Type::String + name: "connectionProfileId" + required: true + input: true + url_param_only: true + description: | + The ID of the workstation cluster. + - !ruby/object:Api::Type::String + name: "location" + input: true + url_param_only: true + description: | + The location where the connection profile should reside. + properties: + - !ruby/object:Api::Type::String + name: "name" + description: | + The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}. + - !ruby/object:Api::Type::String + name: "displayName" + description: | + The connection profile display name. + - !ruby/object:Api::Type::Time + name: "createTime" + output: true + description: | + Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". + - !ruby/object:Api::Type::Time + name: "updateime" + output: true + description: | + Output only. The timestamp when the resource was last updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". + - !ruby/object:Api::Type::KeyValuePairs + name: "labels" + description: | + The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. + - !ruby/object:Api::Type::Enum + name: 'state' + description: | + The current connection profile state. + values: + - :DRAFT + - :READY + - :FAILED + - !ruby/object:Api::Type::NestedObject + name: "error" + description: | + Output only. The error details in case of state FAILED. + output: true + properties: + - !ruby/object:Api::Type::Integer + name: "code" + output: true + description: | + The status code, which should be an enum value of google.rpc.Code. + - !ruby/object:Api::Type::String + name: "message" + output: true + description: | + Human readable message indicating details about the current status. + - !ruby/object:Api::Type::Array + name: 'details' + description: | + A list of messages that carry the error details. + item_type: Api::Type::KeyValuePairs + output: true + - !ruby/object:Api::Type::Enum + name: 'provider' + description: | + The database provider. + values: + - :CLOUDSQL + - :RDS + - :AURORA + - :ALLOYDB + - !ruby/object:Api::Type::NestedObject + name: "mysql" + description: | + Specifies connection parameters required specifically for MySQL databases. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: "host" + required: true + description: | + Required. The IP or hostname of the source MySQL database. + - !ruby/object:Api::Type::Integer + name: "port" + required: true + description: | + Required. The network port of the source MySQL database. + - !ruby/object:Api::Type::String + name: "username" + required: true + description: | + Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::String + name: "password" + required: true + input: true + description: | + Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. + This field is not returned on request, and the value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::Boolean + name: "passwordSet" + output: true + description: | + Output only. Indicates If this connection profile password is stored. + - !ruby/object:Api::Type::NestedObject + name: "ssl" + description: | + SSL configuration for the destination to connect to the source database. + properties: + - !ruby/object:Api::Type::Enum + name: 'type' + output: true + description: | + The current connection profile state. + values: + - :SERVER_ONLY + - :SERVER_CLIENT + - !ruby/object:Api::Type::String + name: "clientKey" + input: true + description: | + Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. + If this field is used then the 'clientCertificate' field is mandatory. + - !ruby/object:Api::Type::String + name: "clientCertificate" + input: true + description: | + Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. + If this field is used then the 'clientKey' field is mandatory + - !ruby/object:Api::Type::String + name: "caCertificate" + input: true + required: true + description: | + Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. + The replica will use this certificate to verify it's connecting to the right host. + - !ruby/object:Api::Type::String + name: "cloudSqlId" + description: | + If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. + - !ruby/object:Api::Type::NestedObject + name: "postgresql" + description: | + Specifies connection parameters required specifically for MySQL databases. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: "host" + required: true + description: | + Required. The IP or hostname of the source MySQL database. + - !ruby/object:Api::Type::Integer + name: "port" + required: true + description: | + Required. The network port of the source MySQL database. + - !ruby/object:Api::Type::String + name: "username" + required: true + description: | + Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::String + name: "password" + required: true + input: true + description: | + Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. + This field is not returned on request, and the value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::Boolean + name: "passwordSet" + output: true + description: | + Output only. Indicates If this connection profile password is stored. + - !ruby/object:Api::Type::NestedObject + name: "ssl" + description: | + SSL configuration for the destination to connect to the source database. + properties: + - !ruby/object:Api::Type::Enum + name: 'type' + output: true + description: | + The current connection profile state. + values: + - :SERVER_ONLY + - :SERVER_CLIENT + - !ruby/object:Api::Type::String + name: "clientKey" + input: true + required_with: client_certificate + description: | + Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. + If this field is used then the 'clientCertificate' field is mandatory. + - !ruby/object:Api::Type::String + name: "clientCertificate" + input: true + required_with: client_Key + description: | + Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. + If this field is used then the 'clientKey' field is mandatory + - !ruby/object:Api::Type::String + name: "caCertificate" + input: true + required: true + description: | + Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. + The replica will use this certificate to verify it's connecting to the right host. + - !ruby/object:Api::Type::String + name: "cloudSqlId" + description: | + If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. + - !ruby/object:Api::Type::Enum + name: 'networkArchitecture' + output: true + description: | + Output only. If the source is a Cloud SQL database, this field indicates the network architecture it's associated with. + values: + - :NETWORK_ARCHITECTURE_OLD_CSQL_PRODUCER + - :NETWORK_ARCHITECTURE_NEW_CSQL_PRODUCER + - !ruby/object:Api::Type::NestedObject + - !ruby/object:Api::Type::NestedObject + name: "postgresql" + description: | + Specifies connection parameters required specifically for MySQL databases. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: "cloudSqlId" + output: true + description: | + Output only. The Cloud SQL instance ID that this connection profile is associated with. + - !ruby/object:Api::Type::NestedObject + name: "settings" + description: | + Immutable. Metadata used to create the destination Cloud SQL database. + properties: + - !ruby/object:Api::Type::String + name: 'databaseVersion' + description: | + The database engine type and version. + Currently supported values located at https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles#sqldatabaseversion + - !ruby/object:Api::Type::KeyValuePairs + name: "userLabels" + description: | + The resource labels for a Cloud SQL instance to use to annotate any related underlying resources such as Compute Engine VMs. + - !ruby/object:Api::Type::String + name: "tier" + description: | + The tier (or machine type) for this instance, for example: db-n1-standard-1 (MySQL instances) or db-custom-1-3840 (PostgreSQL instances). + For more information, see https://cloud.google.com/sql/docs/mysql/instance-settings + - !ruby/object:Api::Type::String + name: "storageAutoResizeLimit" + description: | + The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit. + - !ruby/object:Api::Type::Enum + name: 'activationPolicy' + description: | + The activation policy specifies when the instance is activated; it is applicable only when the instance state is 'RUNNABLE'. + values: + - :ALWAYS + - :NEVER + - !ruby/object:Api::Type::NestedObject + name: "ipConfig" + description: | + The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address cannot be disabled. + properties: + - !ruby/object:Api::Type::Boolean + name: "enableIpv4" + description: | + Whether the instance should be assigned an IPv4 address or not. + - !ruby/object:Api::Type::String + name: "privateNetwork" + description: | + The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. + This setting can be updated, but it cannot be removed after it is set. + - !ruby/object:Api::Type::Boolean + name: "requireSsl" + description: | + Whether SSL connections over IP should be enforced or not. + - !ruby/object:Api::Type::Array + name: 'authorizedNetworks' + description: | + The list of external networks that are allowed to connect to the instance using the IP. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'value' + description: | + The allowlisted value for the access control list. + required: true + - !ruby/object:Api::Type::String + name: 'label' + description: | + A label to identify this entry. + - !ruby/object:Api::Type::Time + name: 'expireTime' + exactly_one_of: + - expire_time + - ttl + description: | + The time when this access control entry expires in RFC 3339 format. + - !ruby/object:Api::Type::Time + name: 'value' + input: true + description: | + Input only. The time-to-leave of this access control entry. + - !ruby/object:Api::Type::Boolean + name: "autoStorageIncrease" + description: | + If you enable this setting, Cloud SQL checks your available storage every 30 seconds. If the available storage falls below a threshold size, Cloud SQL automatically adds additional storage capacity. + If the available storage repeatedly falls below the threshold size, Cloud SQL continues to add storage until it reaches the maximum of 30 TB. + - !ruby/object:Api::Type::KeyValuePairs + name: "databaseFlags" + description: | + The database flags passed to the Cloud SQL instance at startup. + - !ruby/object:Api::Type::Enum + name: 'dataDiskType' + description: | + The type of storage. + values: + - :PD_SSD + - :PD_HDD + - !ruby/object:Api::Type::String + name: "dataDiskSizeGb" + description: | + The storage capacity available to the database, in GB. The minimum (and default) size is 10GB. + - !ruby/object:Api::Type::String + name: "zone" + description: | + The Google Cloud Platform zone where your Cloud SQL datdabse instance is located. + - !ruby/object:Api::Type::String + name: "sourceId" + description: | + The Database Migration Service source connection profile ID, in the format: projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID + - !ruby/object:Api::Type::String + name: "rootPassword" + input: true + description: | + Input only. Initial root password. + - !ruby/object:Api::Type::Boolean + name: "rootPasswordSet" + output: true + description: | + Output only. Indicates If this connection profile root password is stored. + - !ruby/object:Api::Type::String + name: "collation" + description: | + The Cloud SQL default instance level collation. + - !ruby/object:Api::Type::String + name: "cmekKeyName" + description: | + The KMS key name used for the csql instance. + - !ruby/object:Api::Type::String + name: "privateIp" + output: true + description: | + Output only. The Cloud SQL database instance's private IP. + - !ruby/object:Api::Type::String + name: "publicIp" + output: true + description: | + Output only. The Cloud SQL database instance's public IP. + - !ruby/object:Api::Type::NestedObject + name: "alloydb" + description: | + Specifies connection parameters required specifically for MySQL databases. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: "clusterId" + required: true + description: | + Required. The AlloyDB cluster ID that this connection profile is associated with. + - !ruby/object:Api::Type::NestedObject + name: "settings" + input: true + description: | + Immutable. Metadata used to create the destination AlloyDB cluster. + properties: + - !ruby/object:Api::Type::NestedObject + name: "initialUser" + required: true + input: true + description: | + Required. Input only. Initial user to setup during cluster creation. + properties: + - !ruby/object:Api::Type::String + name: "username" + required: true + description: | + The database username. + name: "password" + required: true + description: | + The initial password for the user. + - !ruby/object:Api::Type::Boolean + name: "passwordSet" + output: true + description: | + Output only. Indicates if the initialUser.password field has been set. + - !ruby/object:Api::Type::String + name: "vpcNetwork" + required: true + description: | + Required. The resource link for the VPC network in which cluster resources are created and from which they are accessible via Private IP. The network must belong to the same project as the cluster. + It is specified in the form: "projects/{project_number}/global/networks/{network_id}". This is required to create a cluster. + - !ruby/object:Api::Type::KeyValuePairs + name: "labels" + description: | + Labels for the AlloyDB cluster created by DMS. + - !ruby/object:Api::Type::NestedObject + name: "primaryInstanceSettings" + description: | + Settings for the cluster's primary instance + properties: + - !ruby/object:Api::Type::String + name: "id" + required: true + description: | + The database username. + - !ruby/object:Api::Type::NestedObject + name: "machineConfig" + required: true + input: true + description: | + Configuration for the machines that host the underlying database engine. + properties: + - !ruby/object:Api::Type::Integer + name: "cpuCount" + required: true + description: | + The number of CPU's in the VM instance. + - !ruby/object:Api::Type::KeyValuePairs + name: "databaseFlags" + description: | + Database flags to pass to AlloyDB when DMS is creating the AlloyDB cluster and instances. See the AlloyDB documentation for how these can be used. + - !ruby/object:Api::Type::KeyValuePairs + name: "labels" + description: | + Labels for the AlloyDB primary instance created by DMS. + - !ruby/object:Api::Type::String + name: "privateIp" + output: true + description: | + Output only. The private IP address for the Instance. This is the connection endpoint for an end-user application. + + + \ No newline at end of file From 4ce4656368ee1a26be308a01e1c514588c5dbd55 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Wed, 1 Feb 2023 12:50:59 -0800 Subject: [PATCH 02/22] Updates --- mmv1/products/databasemigrationservice/api.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mmv1/products/databasemigrationservice/api.yaml b/mmv1/products/databasemigrationservice/api.yaml index 58d967cbfc0e..6b25f264efa3 100644 --- a/mmv1/products/databasemigrationservice/api.yaml +++ b/mmv1/products/databasemigrationservice/api.yaml @@ -28,22 +28,22 @@ apis_required: objects: - !ruby/object:Api::Resource name: "ConnectionProfile" - #self_link: "projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}" - #base_url: "projects/{{project}}/locations/{{location}}/connectionProfiles" - #create_url: "projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}" - #description: "A managed workstation cluster." + self_link: "projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}" + base_url: "projects/{{project}}/locations/{{location}}/connectionProfiles" + create_url: "projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}" + description: "A connection profile definition." references: !ruby/object:Api::Resource::ReferenceLinks guides: - # "Workstations": "https://cloud.google.com/database-migration/docs/" - # api: "https://cloud.google.com/workstations/docs/reference/rest/v1/projects.locations.connectionProfiles/create" + "Workstations": "https://cloud.google.com/database-migration/docs/" + api: "https://cloud.google.com/workstations/docs/reference/rest/v1/projects.locations.connectionProfiles/create" parameters: - # - !ruby/object:Api::Type::String + - !ruby/object:Api::Type::String name: "connectionProfileId" required: true input: true url_param_only: true description: | - The ID of the workstation cluster. + The ID of the connection profile. - !ruby/object:Api::Type::String name: "location" input: true From 2ad090dcb37e031cb1588e052838120b216ea0cf Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Wed, 1 Feb 2023 13:33:19 -0800 Subject: [PATCH 03/22] Updates --- mmv1/products/databasemigrationservice/api.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/products/databasemigrationservice/api.yaml b/mmv1/products/databasemigrationservice/api.yaml index 6b25f264efa3..11be3cf3042a 100644 --- a/mmv1/products/databasemigrationservice/api.yaml +++ b/mmv1/products/databasemigrationservice/api.yaml @@ -11,8 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- -!ruby/object:Api::Product +--- !ruby/object:Api::Product name: DatabaseMigrationService display_name: DatabaseMigrationService versions: @@ -31,11 +30,12 @@ objects: self_link: "projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}" base_url: "projects/{{project}}/locations/{{location}}/connectionProfiles" create_url: "projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}" + update_verb: :PATCH description: "A connection profile definition." references: !ruby/object:Api::Resource::ReferenceLinks guides: - "Workstations": "https://cloud.google.com/database-migration/docs/" - api: "https://cloud.google.com/workstations/docs/reference/rest/v1/projects.locations.connectionProfiles/create" + "Database Migration": "https://cloud.google.com/database-migration/docs/" + api: "https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create" parameters: - !ruby/object:Api::Type::String name: "connectionProfileId" From 9f81375ef86cc10f12a187fb646d01d4af217c6e Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Thu, 2 Feb 2023 15:09:55 -0800 Subject: [PATCH 04/22] Added custom flattens for sensitive fields --- .../databasemigrationservice/api.yaml | 193 +++++++++--------- .../databasemigrationservice/terraform.yaml | 49 +++++ ...oydb_settings_initial_user_password.go.erb | 17 ++ ...ile_cloudsql_settings_root_password.go.erb | 17 ++ ...e_connection_profile_mysql_password.go.erb | 17 ++ ...on_profile_mysql_ssl_ca_certificate.go.erb | 17 ++ ...rofile_mysql_ssl_client_certificate.go.erb | 17 ++ ...ection_profile_mysql_ssl_client_key.go.erb | 17 ++ ...nection_profile_postgresql_password.go.erb | 17 ++ ...ofile_postgresql_ssl_ca_certificate.go.erb | 17 ++ ...e_postgresql_ssl_client_certificate.go.erb | 17 ++ ...n_profile_postgresql_ssl_client_key.go.erb | 17 ++ 12 files changed, 317 insertions(+), 95 deletions(-) create mode 100644 mmv1/products/databasemigrationservice/terraform.yaml create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.erb create mode 100644 mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.erb diff --git a/mmv1/products/databasemigrationservice/api.yaml b/mmv1/products/databasemigrationservice/api.yaml index 11be3cf3042a..e9dfb69e97ae 100644 --- a/mmv1/products/databasemigrationservice/api.yaml +++ b/mmv1/products/databasemigrationservice/api.yaml @@ -1,12 +1,12 @@ # Copyright 2022 Google Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); +# 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, +# 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. @@ -17,7 +17,7 @@ display_name: DatabaseMigrationService versions: - !ruby/object:Api::Product::Version name: ga - base_url: https://datamigration.googleapis.com + base_url: https://datamigration.googleapis.com/v1/ scopes: - https://www.googleapis.com/auth/cloud-platform apis_required: @@ -26,51 +26,51 @@ apis_required: url: https://console.cloud.google.com/apis/library/datamigration.googleapis.com objects: - !ruby/object:Api::Resource - name: "ConnectionProfile" - self_link: "projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}" - base_url: "projects/{{project}}/locations/{{location}}/connectionProfiles" - create_url: "projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}" + name: 'ConnectionProfile' + self_link: 'projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}' + base_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles' + create_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}' update_verb: :PATCH - description: "A connection profile definition." + description: 'A connection profile definition.' references: !ruby/object:Api::Resource::ReferenceLinks guides: - "Database Migration": "https://cloud.google.com/database-migration/docs/" - api: "https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create" + 'Database Migration': 'https://cloud.google.com/database-migration/docs/' + api: 'https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create' parameters: - !ruby/object:Api::Type::String - name: "connectionProfileId" + name: 'connectionProfileId' required: true input: true url_param_only: true description: | The ID of the connection profile. - !ruby/object:Api::Type::String - name: "location" + name: 'location' input: true url_param_only: true description: | The location where the connection profile should reside. properties: - !ruby/object:Api::Type::String - name: "name" + name: 'name' description: | The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}. - !ruby/object:Api::Type::String - name: "displayName" + name: 'displayName' description: | The connection profile display name. - !ruby/object:Api::Type::Time - name: "createTime" + name: 'createTime' output: true description: | - Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". + Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. - !ruby/object:Api::Type::Time - name: "updateime" + name: 'updateime' output: true description: | - Output only. The timestamp when the resource was last updated. A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z". + Output only. The timestamp when the resource was last updated. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. - !ruby/object:Api::Type::KeyValuePairs - name: "labels" + name: 'labels' description: | The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. - !ruby/object:Api::Type::Enum @@ -82,38 +82,39 @@ objects: - :READY - :FAILED - !ruby/object:Api::Type::NestedObject - name: "error" + name: 'error' description: | Output only. The error details in case of state FAILED. output: true properties: - !ruby/object:Api::Type::Integer - name: "code" + name: 'code' output: true description: | The status code, which should be an enum value of google.rpc.Code. - !ruby/object:Api::Type::String - name: "message" + name: 'message' output: true description: | Human readable message indicating details about the current status. - !ruby/object:Api::Type::Array name: 'details' - description: | - A list of messages that carry the error details. - item_type: Api::Type::KeyValuePairs - output: true + description: | + A list of messages that carry the error details. + item_type: Api::Type::KeyValuePairs + output: true - !ruby/object:Api::Type::Enum - name: 'provider' + name: 'dbprovider' description: | The database provider. + api_name: provider values: - :CLOUDSQL - :RDS - :AURORA - :ALLOYDB - !ruby/object:Api::Type::NestedObject - name: "mysql" + name: 'mysql' description: | Specifies connection parameters required specifically for MySQL databases. exactly_one_of: @@ -123,34 +124,34 @@ objects: - alloydb properties: - !ruby/object:Api::Type::String - name: "host" + name: 'host' required: true description: | Required. The IP or hostname of the source MySQL database. - !ruby/object:Api::Type::Integer - name: "port" + name: 'port' required: true description: | Required. The network port of the source MySQL database. - !ruby/object:Api::Type::String - name: "username" + name: 'username' required: true description: | Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. - !ruby/object:Api::Type::String - name: "password" + name: 'password' required: true input: true description: | Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service. - !ruby/object:Api::Type::Boolean - name: "passwordSet" + name: 'passwordSet' output: true description: | Output only. Indicates If this connection profile password is stored. - !ruby/object:Api::Type::NestedObject - name: "ssl" + name: 'ssl' description: | SSL configuration for the destination to connect to the source database. properties: @@ -163,32 +164,32 @@ objects: - :SERVER_ONLY - :SERVER_CLIENT - !ruby/object:Api::Type::String - name: "clientKey" + name: 'clientKey' input: true description: | Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. If this field is used then the 'clientCertificate' field is mandatory. - !ruby/object:Api::Type::String - name: "clientCertificate" + name: 'clientCertificate' input: true description: | Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. If this field is used then the 'clientKey' field is mandatory - !ruby/object:Api::Type::String - name: "caCertificate" + name: 'caCertificate' input: true required: true description: | Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. The replica will use this certificate to verify it's connecting to the right host. - !ruby/object:Api::Type::String - name: "cloudSqlId" + name: 'cloudSqlId' description: | If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. - !ruby/object:Api::Type::NestedObject - name: "postgresql" + name: 'postgresql' description: | - Specifies connection parameters required specifically for MySQL databases. + Specifies connection parameters required specifically for PostgreSQL databases. exactly_one_of: - mysql - postgresql @@ -196,34 +197,34 @@ objects: - alloydb properties: - !ruby/object:Api::Type::String - name: "host" + name: 'host' required: true description: | Required. The IP or hostname of the source MySQL database. - !ruby/object:Api::Type::Integer - name: "port" + name: 'port' required: true description: | Required. The network port of the source MySQL database. - !ruby/object:Api::Type::String - name: "username" + name: 'username' required: true description: | Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. - !ruby/object:Api::Type::String - name: "password" + name: 'password' required: true input: true description: | Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service. - !ruby/object:Api::Type::Boolean - name: "passwordSet" + name: 'passwordSet' output: true description: | Output only. Indicates If this connection profile password is stored. - !ruby/object:Api::Type::NestedObject - name: "ssl" + name: 'ssl' description: | SSL configuration for the destination to connect to the source database. properties: @@ -236,28 +237,30 @@ objects: - :SERVER_ONLY - :SERVER_CLIENT - !ruby/object:Api::Type::String - name: "clientKey" + name: 'clientKey' input: true - required_with: client_certificate + required_with: + - client_certificate description: | Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. If this field is used then the 'clientCertificate' field is mandatory. - !ruby/object:Api::Type::String - name: "clientCertificate" + name: 'clientCertificate' input: true - required_with: client_Key + required_with: + - client_key description: | Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. If this field is used then the 'clientKey' field is mandatory - !ruby/object:Api::Type::String - name: "caCertificate" + name: 'caCertificate' input: true required: true description: | Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. The replica will use this certificate to verify it's connecting to the right host. - !ruby/object:Api::Type::String - name: "cloudSqlId" + name: 'cloudSqlId' description: | If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. - !ruby/object:Api::Type::Enum @@ -270,9 +273,9 @@ objects: - :NETWORK_ARCHITECTURE_NEW_CSQL_PRODUCER - !ruby/object:Api::Type::NestedObject - !ruby/object:Api::Type::NestedObject - name: "postgresql" + name: 'cloudsql' description: | - Specifies connection parameters required specifically for MySQL databases. + Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance. exactly_one_of: - mysql - postgresql @@ -280,12 +283,12 @@ objects: - alloydb properties: - !ruby/object:Api::Type::String - name: "cloudSqlId" + name: 'cloudSqlId' output: true description: | Output only. The Cloud SQL instance ID that this connection profile is associated with. - !ruby/object:Api::Type::NestedObject - name: "settings" + name: 'settings' description: | Immutable. Metadata used to create the destination Cloud SQL database. properties: @@ -295,16 +298,16 @@ objects: The database engine type and version. Currently supported values located at https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles#sqldatabaseversion - !ruby/object:Api::Type::KeyValuePairs - name: "userLabels" + name: 'userLabels' description: | The resource labels for a Cloud SQL instance to use to annotate any related underlying resources such as Compute Engine VMs. - !ruby/object:Api::Type::String - name: "tier" + name: 'tier' description: | The tier (or machine type) for this instance, for example: db-n1-standard-1 (MySQL instances) or db-custom-1-3840 (PostgreSQL instances). For more information, see https://cloud.google.com/sql/docs/mysql/instance-settings - !ruby/object:Api::Type::String - name: "storageAutoResizeLimit" + name: 'storageAutoResizeLimit' description: | The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit. - !ruby/object:Api::Type::Enum @@ -315,21 +318,21 @@ objects: - :ALWAYS - :NEVER - !ruby/object:Api::Type::NestedObject - name: "ipConfig" + name: 'ipConfig' description: | The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address cannot be disabled. properties: - !ruby/object:Api::Type::Boolean - name: "enableIpv4" + name: 'enableIpv4' description: | - Whether the instance should be assigned an IPv4 address or not. + Whether the instance should be assigned an IPv4 address or not. - !ruby/object:Api::Type::String - name: "privateNetwork" + name: 'privateNetwork' description: | The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. This setting can be updated, but it cannot be removed after it is set. - !ruby/object:Api::Type::Boolean - name: "requireSsl" + name: 'requireSsl' description: | Whether SSL connections over IP should be enforced or not. - !ruby/object:Api::Type::Array @@ -355,17 +358,17 @@ objects: description: | The time when this access control entry expires in RFC 3339 format. - !ruby/object:Api::Type::Time - name: 'value' + name: 'ttl' input: true description: | Input only. The time-to-leave of this access control entry. - !ruby/object:Api::Type::Boolean - name: "autoStorageIncrease" + name: 'autoStorageIncrease' description: | If you enable this setting, Cloud SQL checks your available storage every 30 seconds. If the available storage falls below a threshold size, Cloud SQL automatically adds additional storage capacity. If the available storage repeatedly falls below the threshold size, Cloud SQL continues to add storage until it reaches the maximum of 30 TB. - !ruby/object:Api::Type::KeyValuePairs - name: "databaseFlags" + name: 'databaseFlags' description: | The database flags passed to the Cloud SQL instance at startup. - !ruby/object:Api::Type::Enum @@ -376,49 +379,49 @@ objects: - :PD_SSD - :PD_HDD - !ruby/object:Api::Type::String - name: "dataDiskSizeGb" + name: 'dataDiskSizeGb' description: | The storage capacity available to the database, in GB. The minimum (and default) size is 10GB. - !ruby/object:Api::Type::String - name: "zone" + name: 'zone' description: | The Google Cloud Platform zone where your Cloud SQL datdabse instance is located. - !ruby/object:Api::Type::String - name: "sourceId" + name: 'sourceId' description: | The Database Migration Service source connection profile ID, in the format: projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID - !ruby/object:Api::Type::String - name: "rootPassword" + name: 'rootPassword' input: true description: | Input only. Initial root password. - !ruby/object:Api::Type::Boolean - name: "rootPasswordSet" + name: 'rootPasswordSet' output: true description: | Output only. Indicates If this connection profile root password is stored. - !ruby/object:Api::Type::String - name: "collation" + name: 'collation' description: | The Cloud SQL default instance level collation. - !ruby/object:Api::Type::String - name: "cmekKeyName" + name: 'cmekKeyName' description: | The KMS key name used for the csql instance. - !ruby/object:Api::Type::String - name: "privateIp" + name: 'privateIp' output: true description: | Output only. The Cloud SQL database instance's private IP. - !ruby/object:Api::Type::String - name: "publicIp" + name: 'publicIp' output: true description: | Output only. The Cloud SQL database instance's public IP. - - !ruby/object:Api::Type::NestedObject - name: "alloydb" + - !ruby/object:Api::Type::NestedObject + name: 'alloydb' description: | - Specifies connection parameters required specifically for MySQL databases. + Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster. exactly_one_of: - mysql - postgresql @@ -426,79 +429,79 @@ objects: - alloydb properties: - !ruby/object:Api::Type::String - name: "clusterId" + name: 'clusterId' required: true description: | Required. The AlloyDB cluster ID that this connection profile is associated with. - !ruby/object:Api::Type::NestedObject - name: "settings" + name: 'settings' input: true description: | Immutable. Metadata used to create the destination AlloyDB cluster. properties: - !ruby/object:Api::Type::NestedObject - name: "initialUser" + name: 'initialUser' required: true input: true description: | Required. Input only. Initial user to setup during cluster creation. properties: - !ruby/object:Api::Type::String - name: "username" + name: 'username' required: true description: | The database username. - name: "password" + name: 'password' required: true description: | The initial password for the user. - !ruby/object:Api::Type::Boolean - name: "passwordSet" + name: 'passwordSet' output: true description: | Output only. Indicates if the initialUser.password field has been set. - !ruby/object:Api::Type::String - name: "vpcNetwork" + name: 'vpcNetwork' required: true description: | Required. The resource link for the VPC network in which cluster resources are created and from which they are accessible via Private IP. The network must belong to the same project as the cluster. - It is specified in the form: "projects/{project_number}/global/networks/{network_id}". This is required to create a cluster. + It is specified in the form: 'projects/{project_number}/global/networks/{network_id}'. This is required to create a cluster. - !ruby/object:Api::Type::KeyValuePairs - name: "labels" + name: 'labels' description: | Labels for the AlloyDB cluster created by DMS. - !ruby/object:Api::Type::NestedObject - name: "primaryInstanceSettings" + name: 'primaryInstanceSettings' description: | Settings for the cluster's primary instance properties: - !ruby/object:Api::Type::String - name: "id" + name: 'id' required: true description: | The database username. - !ruby/object:Api::Type::NestedObject - name: "machineConfig" + name: 'machineConfig' required: true input: true description: | Configuration for the machines that host the underlying database engine. properties: - !ruby/object:Api::Type::Integer - name: "cpuCount" + name: 'cpuCount' required: true description: | The number of CPU's in the VM instance. - !ruby/object:Api::Type::KeyValuePairs - name: "databaseFlags" + name: 'databaseFlags' description: | Database flags to pass to AlloyDB when DMS is creating the AlloyDB cluster and instances. See the AlloyDB documentation for how these can be used. - !ruby/object:Api::Type::KeyValuePairs - name: "labels" + name: 'labels' description: | Labels for the AlloyDB primary instance created by DMS. - !ruby/object:Api::Type::String - name: "privateIp" + name: 'privateIp' output: true description: | Output only. The private IP address for the Instance. This is the connection endpoint for an end-user application. diff --git a/mmv1/products/databasemigrationservice/terraform.yaml b/mmv1/products/databasemigrationservice/terraform.yaml new file mode 100644 index 000000000000..1dee22e89865 --- /dev/null +++ b/mmv1/products/databasemigrationservice/terraform.yaml @@ -0,0 +1,49 @@ +# Copyright 2022 Google Inc. +# 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. + +--- !ruby/object:Provider::Terraform::Config +overrides: !ruby/object:Overrides::ResourceOverrides + ConnectionProfile: !ruby/object:Overrides::Terraform::ResourceOverride + properties: + state: !ruby/object:Overrides::Terraform::PropertyOverride + default_from_api: true + mysql.password: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.erb + mysql.ssl.clientKey: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.erb + mysql.ssl.clientCertificate: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.erb + mysql.ssl.caCertificate: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.erb + postgresql.password: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.erb + postgresql.ssl.clientKey: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.erb + postgresql.ssl.clientCertificate: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.erb + postgresql.ssl.caCertificate: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.erb + cloudsql.settings.rootPassword: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.erb + alloydb.settings.initialUser.password: !ruby/object:Overrides::Terraform::PropertyOverride + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.erb \ No newline at end of file diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.erb new file mode 100644 index 000000000000..9132db6fb166 --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("alloydb.0.settings.0.initial_user.0.password") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.erb new file mode 100644 index 000000000000..e7cd9417fa4b --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("cloudsql.0.settings.0.root_password") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.erb new file mode 100644 index 000000000000..dde688757efc --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("mysql.0.password") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.erb new file mode 100644 index 000000000000..4f501a09f582 --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("mysql.0.ssl.0.ca_certificate") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.erb new file mode 100644 index 000000000000..27f6f4accd77 --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("mysql.0.ssl.0.client_certificate") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.erb new file mode 100644 index 000000000000..58071c8d9720 --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("mysql.0.ssl.0.client_key") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.erb new file mode 100644 index 000000000000..e1536c5ce54d --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("postgresql.0.password") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.erb new file mode 100644 index 000000000000..e10266020b6c --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("postgresql.0.ssl.0.ca_certificate") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.erb new file mode 100644 index 000000000000..aebc94cd07fe --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("postgresql.0.ssl.0.client_certificate") +} diff --git a/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.erb b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.erb new file mode 100644 index 000000000000..7daed24b62d5 --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2023 Google Inc. + # 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. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *Config) interface{} { + return d.Get("postgresql.0.ssl.0.client_key") +} From 77e8bc835f80498daaa5a6db1bb7f4ee904a3f23 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 3 Feb 2023 13:53:52 -0800 Subject: [PATCH 05/22] missing api tag --- mmv1/products/databasemigrationservice/api.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mmv1/products/databasemigrationservice/api.yaml b/mmv1/products/databasemigrationservice/api.yaml index e9dfb69e97ae..82f3594f7a79 100644 --- a/mmv1/products/databasemigrationservice/api.yaml +++ b/mmv1/products/databasemigrationservice/api.yaml @@ -30,7 +30,8 @@ objects: self_link: 'projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}' base_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles' create_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}' - update_verb: :PATCH + update_verb: :PATCH + update_mask: true description: 'A connection profile definition.' references: !ruby/object:Api::Resource::ReferenceLinks guides: @@ -447,10 +448,11 @@ objects: Required. Input only. Initial user to setup during cluster creation. properties: - !ruby/object:Api::Type::String - name: 'username' + name: 'user' required: true description: | The database username. + - !ruby/object:Api::Type::String name: 'password' required: true description: | From de64b2e2265f3d4ead98c3b3c6113e9008cc549e Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Mon, 13 Feb 2023 01:21:43 -0800 Subject: [PATCH 06/22] updated required tags for field --- mmv1/products/databasemigrationservice/api.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/databasemigrationservice/api.yaml b/mmv1/products/databasemigrationservice/api.yaml index 82f3594f7a79..b1449bc0e3b1 100644 --- a/mmv1/products/databasemigrationservice/api.yaml +++ b/mmv1/products/databasemigrationservice/api.yaml @@ -389,6 +389,7 @@ objects: The Google Cloud Platform zone where your Cloud SQL datdabse instance is located. - !ruby/object:Api::Type::String name: 'sourceId' + required: true description: | The Database Migration Service source connection profile ID, in the format: projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID - !ruby/object:Api::Type::String From 33461f4b7f8482caca8f396ac7bf31a5274665c7 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Sun, 12 Mar 2023 22:46:42 -0700 Subject: [PATCH 07/22] re formatted into splitting api.yaml, added example tests --- .../connectionprofile.yaml | 499 ++++++++++++++++++ .../databasemigrationservice/product.yaml | 13 + ..._service_connection_profile.alloydb.tf.erb | 57 ++ ...service_connection_profile.cloudsql.tf.erb | 89 ++++ ..._service_connection_profile.postgre.tf.erb | 47 ++ 5 files changed, 705 insertions(+) create mode 100644 mmv1/products/databasemigrationservice/connectionprofile.yaml create mode 100644 mmv1/products/databasemigrationservice/product.yaml create mode 100644 mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb create mode 100644 mmv1/templates/terraform/examples/database_migration_service_connection_profile.cloudsql.tf.erb create mode 100644 mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml new file mode 100644 index 000000000000..7e54c3025e50 --- /dev/null +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -0,0 +1,499 @@ +# Copyright 2022 Google Inc. +# 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. + +--- !ruby/object:Api::Resource +name: 'ConnectionProfile' +self_link: 'projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}' +base_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles' +create_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}' +update_verb: :PATCH +update_mask: true +description: 'A connection profile definition.' +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Database Migration': 'https://cloud.google.com/database-migration/docs/' + api: 'https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create' +parameters: + - !ruby/object:Api::Type::String + name: 'connectionProfileId' + required: true + input: true + url_param_only: true + description: | + The ID of the connection profile. + - !ruby/object:Api::Type::String + name: 'location' + input: true + url_param_only: true + description: | + The location where the connection profile should reside. +properties: + - !ruby/object:Api::Type::String + name: 'name' + description: | + The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}. + - !ruby/object:Api::Type::String + name: 'displayName' + description: | + The connection profile display name. + - !ruby/object:Api::Type::Time + name: 'createTime' + output: true + description: | + Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. + - !ruby/object:Api::Type::Time + name: 'updateime' + output: true + description: | + Output only. The timestamp when the resource was last updated. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. + - !ruby/object:Api::Type::KeyValuePairs + name: 'labels' + description: | + The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. + - !ruby/object:Api::Type::Enum + name: 'state' + description: | + The current connection profile state. + values: + - :DRAFT + - :READY + - :FAILED + - !ruby/object:Api::Type::NestedObject + name: 'error' + description: | + Output only. The error details in case of state FAILED. + output: true + properties: + - !ruby/object:Api::Type::Integer + name: 'code' + output: true + description: | + The status code, which should be an enum value of google.rpc.Code. + - !ruby/object:Api::Type::String + name: 'message' + output: true + description: | + Human readable message indicating details about the current status. + - !ruby/object:Api::Type::Array + name: 'details' + description: | + A list of messages that carry the error details. + item_type: Api::Type::KeyValuePairs + output: true + - !ruby/object:Api::Type::Enum + name: 'dbprovider' + description: | + The database provider. + api_name: provider + values: + - :CLOUDSQL + - :RDS + - :AURORA + - :ALLOYDB + - !ruby/object:Api::Type::NestedObject + name: 'mysql' + description: | + Specifies connection parameters required specifically for MySQL databases. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: 'host' + required: true + description: | + Required. The IP or hostname of the source MySQL database. + - !ruby/object:Api::Type::Integer + name: 'port' + required: true + description: | + Required. The network port of the source MySQL database. + - !ruby/object:Api::Type::String + name: 'username' + required: true + description: | + Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::String + name: 'password' + required: true + input: true + description: | + Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. + This field is not returned on request, and the value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::Boolean + name: 'passwordSet' + output: true + description: | + Output only. Indicates If this connection profile password is stored. + - !ruby/object:Api::Type::NestedObject + name: 'ssl' + description: | + SSL configuration for the destination to connect to the source database. + properties: + - !ruby/object:Api::Type::Enum + name: 'type' + output: true + description: | + The current connection profile state. + values: + - :SERVER_ONLY + - :SERVER_CLIENT + - !ruby/object:Api::Type::String + name: 'clientKey' + input: true + description: | + Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. + If this field is used then the 'clientCertificate' field is mandatory. + - !ruby/object:Api::Type::String + name: 'clientCertificate' + input: true + description: | + Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. + If this field is used then the 'clientKey' field is mandatory + - !ruby/object:Api::Type::String + name: 'caCertificate' + input: true + required: true + description: | + Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. + The replica will use this certificate to verify it's connecting to the right host. + - !ruby/object:Api::Type::String + name: 'cloudSqlId' + description: | + If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. + - !ruby/object:Api::Type::NestedObject + name: 'postgresql' + description: | + Specifies connection parameters required specifically for PostgreSQL databases. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: 'host' + required: true + description: | + Required. The IP or hostname of the source MySQL database. + - !ruby/object:Api::Type::Integer + name: 'port' + required: true + description: | + Required. The network port of the source MySQL database. + - !ruby/object:Api::Type::String + name: 'username' + required: true + description: | + Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::String + name: 'password' + required: true + input: true + description: | + Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. + This field is not returned on request, and the value is encrypted when stored in Database Migration Service. + - !ruby/object:Api::Type::Boolean + name: 'passwordSet' + output: true + description: | + Output only. Indicates If this connection profile password is stored. + - !ruby/object:Api::Type::NestedObject + name: 'ssl' + description: | + SSL configuration for the destination to connect to the source database. + properties: + - !ruby/object:Api::Type::Enum + name: 'type' + output: true + description: | + The current connection profile state. + values: + - :SERVER_ONLY + - :SERVER_CLIENT + - !ruby/object:Api::Type::String + name: 'clientKey' + input: true + required_with: + - client_certificate + description: | + Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. + If this field is used then the 'clientCertificate' field is mandatory. + - !ruby/object:Api::Type::String + name: 'clientCertificate' + input: true + required_with: + - client_key + description: | + Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. + If this field is used then the 'clientKey' field is mandatory + - !ruby/object:Api::Type::String + name: 'caCertificate' + input: true + required: true + description: | + Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. + The replica will use this certificate to verify it's connecting to the right host. + - !ruby/object:Api::Type::String + name: 'cloudSqlId' + description: | + If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. + - !ruby/object:Api::Type::Enum + name: 'networkArchitecture' + output: true + description: | + Output only. If the source is a Cloud SQL database, this field indicates the network architecture it's associated with. + values: + - :NETWORK_ARCHITECTURE_OLD_CSQL_PRODUCER + - :NETWORK_ARCHITECTURE_NEW_CSQL_PRODUCER + - !ruby/object:Api::Type::NestedObject + - !ruby/object:Api::Type::NestedObject + name: 'cloudsql' + description: | + Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: 'cloudSqlId' + output: true + description: | + Output only. The Cloud SQL instance ID that this connection profile is associated with. + - !ruby/object:Api::Type::NestedObject + name: 'settings' + description: | + Immutable. Metadata used to create the destination Cloud SQL database. + properties: + - !ruby/object:Api::Type::String + name: 'databaseVersion' + description: | + The database engine type and version. + Currently supported values located at https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles#sqldatabaseversion + - !ruby/object:Api::Type::KeyValuePairs + name: 'userLabels' + description: | + The resource labels for a Cloud SQL instance to use to annotate any related underlying resources such as Compute Engine VMs. + - !ruby/object:Api::Type::String + name: 'tier' + description: | + The tier (or machine type) for this instance, for example: db-n1-standard-1 (MySQL instances) or db-custom-1-3840 (PostgreSQL instances). + For more information, see https://cloud.google.com/sql/docs/mysql/instance-settings + - !ruby/object:Api::Type::String + name: 'storageAutoResizeLimit' + description: | + The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit. + - !ruby/object:Api::Type::Enum + name: 'activationPolicy' + description: | + The activation policy specifies when the instance is activated; it is applicable only when the instance state is 'RUNNABLE'. + values: + - :ALWAYS + - :NEVER + - !ruby/object:Api::Type::NestedObject + name: 'ipConfig' + description: | + The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address cannot be disabled. + properties: + - !ruby/object:Api::Type::Boolean + name: 'enableIpv4' + description: | + Whether the instance should be assigned an IPv4 address or not. + - !ruby/object:Api::Type::String + name: 'privateNetwork' + description: | + The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. + This setting can be updated, but it cannot be removed after it is set. + - !ruby/object:Api::Type::Boolean + name: 'requireSsl' + description: | + Whether SSL connections over IP should be enforced or not. + - !ruby/object:Api::Type::Array + name: 'authorizedNetworks' + description: | + The list of external networks that are allowed to connect to the instance using the IP. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'value' + description: | + The allowlisted value for the access control list. + required: true + - !ruby/object:Api::Type::String + name: 'label' + description: | + A label to identify this entry. + - !ruby/object:Api::Type::Time + name: 'expireTime' + exactly_one_of: + - expire_time + - ttl + description: | + The time when this access control entry expires in RFC 3339 format. + - !ruby/object:Api::Type::Time + name: 'ttl' + input: true + description: | + Input only. The time-to-leave of this access control entry. + - !ruby/object:Api::Type::Boolean + name: 'autoStorageIncrease' + description: | + If you enable this setting, Cloud SQL checks your available storage every 30 seconds. If the available storage falls below a threshold size, Cloud SQL automatically adds additional storage capacity. + If the available storage repeatedly falls below the threshold size, Cloud SQL continues to add storage until it reaches the maximum of 30 TB. + - !ruby/object:Api::Type::KeyValuePairs + name: 'databaseFlags' + description: | + The database flags passed to the Cloud SQL instance at startup. + - !ruby/object:Api::Type::Enum + name: 'dataDiskType' + description: | + The type of storage. + values: + - :PD_SSD + - :PD_HDD + - !ruby/object:Api::Type::String + name: 'dataDiskSizeGb' + description: | + The storage capacity available to the database, in GB. The minimum (and default) size is 10GB. + - !ruby/object:Api::Type::String + name: 'zone' + description: | + The Google Cloud Platform zone where your Cloud SQL datdabse instance is located. + - !ruby/object:Api::Type::String + name: 'sourceId' + required: true + description: | + The Database Migration Service source connection profile ID, in the format: projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID + - !ruby/object:Api::Type::String + name: 'rootPassword' + input: true + description: | + Input only. Initial root password. + - !ruby/object:Api::Type::Boolean + name: 'rootPasswordSet' + output: true + description: | + Output only. Indicates If this connection profile root password is stored. + - !ruby/object:Api::Type::String + name: 'collation' + description: | + The Cloud SQL default instance level collation. + - !ruby/object:Api::Type::String + name: 'cmekKeyName' + description: | + The KMS key name used for the csql instance. + - !ruby/object:Api::Type::String + name: 'privateIp' + output: true + description: | + Output only. The Cloud SQL database instance's private IP. + - !ruby/object:Api::Type::String + name: 'publicIp' + output: true + description: | + Output only. The Cloud SQL database instance's public IP. + - !ruby/object:Api::Type::NestedObject + name: 'alloydb' + description: | + Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster. + exactly_one_of: + - mysql + - postgresql + - cloudsql + - alloydb + properties: + - !ruby/object:Api::Type::String + name: 'clusterId' + required: true + description: | + Required. The AlloyDB cluster ID that this connection profile is associated with. + - !ruby/object:Api::Type::NestedObject + name: 'settings' + input: true + description: | + Immutable. Metadata used to create the destination AlloyDB cluster. + properties: + - !ruby/object:Api::Type::NestedObject + name: 'initialUser' + required: true + input: true + description: | + Required. Input only. Initial user to setup during cluster creation. + properties: + - !ruby/object:Api::Type::String + name: 'user' + required: true + description: | + The database username. + - !ruby/object:Api::Type::String + name: 'password' + required: true + description: | + The initial password for the user. + - !ruby/object:Api::Type::Boolean + name: 'passwordSet' + output: true + description: | + Output only. Indicates if the initialUser.password field has been set. + - !ruby/object:Api::Type::String + name: 'vpcNetwork' + required: true + description: | + Required. The resource link for the VPC network in which cluster resources are created and from which they are accessible via Private IP. The network must belong to the same project as the cluster. + It is specified in the form: 'projects/{project_number}/global/networks/{network_id}'. This is required to create a cluster. + - !ruby/object:Api::Type::KeyValuePairs + name: 'labels' + description: | + Labels for the AlloyDB cluster created by DMS. + - !ruby/object:Api::Type::NestedObject + name: 'primaryInstanceSettings' + description: | + Settings for the cluster's primary instance + properties: + - !ruby/object:Api::Type::String + name: 'id' + required: true + description: | + The database username. + - !ruby/object:Api::Type::NestedObject + name: 'machineConfig' + required: true + input: true + description: | + Configuration for the machines that host the underlying database engine. + properties: + - !ruby/object:Api::Type::Integer + name: 'cpuCount' + required: true + description: | + The number of CPU's in the VM instance. + - !ruby/object:Api::Type::KeyValuePairs + name: 'databaseFlags' + description: | + Database flags to pass to AlloyDB when DMS is creating the AlloyDB cluster and instances. See the AlloyDB documentation for how these can be used. + - !ruby/object:Api::Type::KeyValuePairs + name: 'labels' + description: | + Labels for the AlloyDB primary instance created by DMS. + - !ruby/object:Api::Type::String + name: 'privateIp' + output: true + description: | + Output only. The private IP address for the Instance. This is the connection endpoint for an end-user application. + + + \ No newline at end of file diff --git a/mmv1/products/databasemigrationservice/product.yaml b/mmv1/products/databasemigrationservice/product.yaml new file mode 100644 index 000000000000..f95c8510af7b --- /dev/null +++ b/mmv1/products/databasemigrationservice/product.yaml @@ -0,0 +1,13 @@ +--- !ruby/object:Api::Product +name: DatabaseMigrationService +display_name: DatabaseMigrationService +versions: + - !ruby/object:Api::Product::Version + name: ga + base_url: https://datamigration.googleapis.com/v1/ +scopes: + - https://www.googleapis.com/auth/cloud-platform +apis_required: + - !ruby/object:Api::Product::ApiReference + name: Database Migration API + url: https://console.cloud.google.com/apis/library/datamigration.googleapis.com \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb new file mode 100644 index 000000000000..59887f631b39 --- /dev/null +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb @@ -0,0 +1,57 @@ +resource "google_compute_network" "default" { + name = "default" +} + +resource "google_compute_global_address" "private_ip_alloc" { + name = "private_ip_alloc" + address_type = "INTERNAL" + purpose = "VPC_PEERING" + prefix_length = 16 + network = google_compute_network.default.id + depends_on = [google_compute_network.default] +} + +resource "google_service_networking_connection" "vpc_connection" { + network = google_compute_network.default.id + service = "servicenetworking.googleapis.com" + reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] + depends_on = [google_compute_network.default] +} + + +resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["alloydb_cp"] %>" + display_name = "<%= ctx[:vars]["alloydb_cp"] %>_display" + name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["alloydb_cp"] %>" + dbprovider = "ALLOYDB" + labels = { + testanno = "testanno" + } + alloydb { + cluster_id = "dbmsalloycluster" + settings { + initial_user { + user = "alloyuser" + password = "alloypass" + } + vpc_network = "projects/${data.google_project.project.number}/global/networks/default" + labels = { + testalloylabela = "testalloylabelb" + } + primary_instance_settings { + id = "priminstid" + machine_config { + cpu_count = 2 + } + database_flags = { + } + labels = { + testalloyinstlabela = "testalloyinstlabelb" + } + } + } + } + + depends_on = [google_service_networking_connection.vpc_connection] +} \ No newline at end of file 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 new file mode 100644 index 000000000000..a083564e2c55 --- /dev/null +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.cloudsql.tf.erb @@ -0,0 +1,89 @@ +resource "google_sql_database_instance" "cloudsqldb" { + name = "<%= ctx[:vars]["cloudsqldb"] %>" + database_version = "MYSQL_5_7" + settings { + tier = "db-n1-standard-1" + } +} + +resource "google_sql_ssl_cert" "cloudsqldb_client_cert" { + common_name = "<%= ctx[:vars]["cloudsqldb_cert"] %>" + instance = google_sql_database_instance.cloudsqldb.name + + depends_on = [google_sql_database_instance.cloudsqldb] +} + +resource "google_sql_user" "coudsqldb_user" { + name = "<%= ctx[:vars]["cloudsqldb_user"] %>" + instance = google_sql_database_instance.cloudsqldb.name + password = "<%= ctx[:vars]["cloudsqldb_pass"] %>" + + depends_on = [google_sql_database_instance.cloudsqldb] +} + + + +resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["cloudsqldb_from_profile"] %>" + display_name = "<%= ctx[:vars]["cloudsqldb_from_profile"] %>_display" + name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["cloudsqldb_from_profile"] %>" + labels = { + testanno = "testanno" + } + mysql { + host = google_sql_database_instance.main.ip_address.0.ip_address + port = 3306 + username = "testusernamecloudsql" + password = "testpasswordcloudsql" + ssl { + client_key = google_sql_ssl_cert.cloudsqldb_client_cert.private_key + client_certificate = google_sql_ssl_cert.cloudsqldb_client_cert.cert + ca_certificate = google_sql_ssl_cert.cloudsqldb_client_cert.server_ca_cert + } + cloud_sql_id = "<%= ctx[:vars]["cloudsqldb"] %>" + } + dbprovider = "CLOUDSQL" + + depends_on = [google_sql_database_instance.cloudsqldb] +} + + +resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["cloudsqldb_to_profile"] %>" + display_name = "<%= ctx[:vars]["cloudsqldb_to_profile"] %>_displayname" + name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["cloudsqldb_to_profile"] %>" + dbprovider = "CLOUDSQL" + labels = { + testlabela = "testlabelb" + } + cloudsql { + settings { + database_version = "MYSQL_5_7" + user_labels = { + testuserlabela = "testuserlabelb" + } + tier = "db-n1-standard-1" + storage_auto_resize_limit = "0" + activation_policy = "ALWAYS" + ip_config { + enable_ipv4 = true + require_ssl = "true" + authorized_networks { + value = google_sql_database_instance.cloudsqldb.ip_address.0.ip_address + label = "testlabel" + } + } + 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.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["cloudsqldb_from_profile"] %>" + root_password = "testpasscloudsql" + } + + + depends_on = [google_sql_database_instance.main] + } +} diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb new file mode 100644 index 000000000000..136aa601a200 --- /dev/null +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb @@ -0,0 +1,47 @@ +resource "google_sql_database_instance" "postgresqldb" { + name = "<%= ctx[:vars]["postgresqldb"] %>" + database_version = "POSTGRES_12" + settings { + tier = "db-custom-2-13312" + } +} + +resource "google_sql_ssl_cert" "postgresql_client_cert" { + common_name = "<%= ctx[:vars]["postgresqldb_cert"] %>" + instance = google_sql_database_instance.postgresqldb.name + + depends_on = [google_sql_database_instance.postgresqldb] +} + +resource "google_sql_user" "postgresql_user" { + name = "<%= ctx[:vars]["postgresqldb_user"] %>" + instance = google_sql_database_instance.postgresqldb.name + password = "<%= ctx[:vars]["postgresqldb_pass"] %>" + + + depends_on = [google_sql_database_instance.postgresqldb] +} + +resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["postgresql_cp"] %>" + display_name = "<%= ctx[:vars]["postgresql_cp"] %>_display" + name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["postgresql_cp"] %>" + labels = { + testanno = "testanno" + } + postgresql { + host = google_sql_database_instance.postgresqldb.ip_address.0.ip_address + port = 5432 + username = "testusernamepostgre" + password = "testpasswordpostgre" + ssl { + client_key = google_sql_ssl_cert.postgresql_client_cert.private_key + client_certificate = google_sql_ssl_cert.postgresql_client_cert.cert + ca_certificate = google_sql_ssl_cert.postgresql_client_cert.server_ca_cert + } + cloud_sql_id = "postgresqldb" + + } + depends_on = [google_sql_database_instance.postgresqldb] +} From efd90327535333aed7d6b60cc07f70f4f0009e53 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Sun, 12 Mar 2023 22:55:41 -0700 Subject: [PATCH 08/22] removing api.yaml --- .../databasemigrationservice/api.yaml | 513 ------------------ 1 file changed, 513 deletions(-) delete mode 100644 mmv1/products/databasemigrationservice/api.yaml diff --git a/mmv1/products/databasemigrationservice/api.yaml b/mmv1/products/databasemigrationservice/api.yaml deleted file mode 100644 index b1449bc0e3b1..000000000000 --- a/mmv1/products/databasemigrationservice/api.yaml +++ /dev/null @@ -1,513 +0,0 @@ -# Copyright 2022 Google Inc. -# 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. - ---- !ruby/object:Api::Product -name: DatabaseMigrationService -display_name: DatabaseMigrationService -versions: - - !ruby/object:Api::Product::Version - name: ga - base_url: https://datamigration.googleapis.com/v1/ -scopes: - - https://www.googleapis.com/auth/cloud-platform -apis_required: - - !ruby/object:Api::Product::ApiReference - name: Database Migration API - url: https://console.cloud.google.com/apis/library/datamigration.googleapis.com -objects: - - !ruby/object:Api::Resource - name: 'ConnectionProfile' - self_link: 'projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}' - base_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles' - create_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}' - update_verb: :PATCH - update_mask: true - description: 'A connection profile definition.' - references: !ruby/object:Api::Resource::ReferenceLinks - guides: - 'Database Migration': 'https://cloud.google.com/database-migration/docs/' - api: 'https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create' - parameters: - - !ruby/object:Api::Type::String - name: 'connectionProfileId' - required: true - input: true - url_param_only: true - description: | - The ID of the connection profile. - - !ruby/object:Api::Type::String - name: 'location' - input: true - url_param_only: true - description: | - The location where the connection profile should reside. - properties: - - !ruby/object:Api::Type::String - name: 'name' - description: | - The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}. - - !ruby/object:Api::Type::String - name: 'displayName' - description: | - The connection profile display name. - - !ruby/object:Api::Type::Time - name: 'createTime' - output: true - description: | - Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. - - !ruby/object:Api::Type::Time - name: 'updateime' - output: true - description: | - Output only. The timestamp when the resource was last updated. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. - - !ruby/object:Api::Type::KeyValuePairs - name: 'labels' - description: | - The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. - - !ruby/object:Api::Type::Enum - name: 'state' - description: | - The current connection profile state. - values: - - :DRAFT - - :READY - - :FAILED - - !ruby/object:Api::Type::NestedObject - name: 'error' - description: | - Output only. The error details in case of state FAILED. - output: true - properties: - - !ruby/object:Api::Type::Integer - name: 'code' - output: true - description: | - The status code, which should be an enum value of google.rpc.Code. - - !ruby/object:Api::Type::String - name: 'message' - output: true - description: | - Human readable message indicating details about the current status. - - !ruby/object:Api::Type::Array - name: 'details' - description: | - A list of messages that carry the error details. - item_type: Api::Type::KeyValuePairs - output: true - - !ruby/object:Api::Type::Enum - name: 'dbprovider' - description: | - The database provider. - api_name: provider - values: - - :CLOUDSQL - - :RDS - - :AURORA - - :ALLOYDB - - !ruby/object:Api::Type::NestedObject - name: 'mysql' - description: | - Specifies connection parameters required specifically for MySQL databases. - exactly_one_of: - - mysql - - postgresql - - cloudsql - - alloydb - properties: - - !ruby/object:Api::Type::String - name: 'host' - required: true - description: | - Required. The IP or hostname of the source MySQL database. - - !ruby/object:Api::Type::Integer - name: 'port' - required: true - description: | - Required. The network port of the source MySQL database. - - !ruby/object:Api::Type::String - name: 'username' - required: true - description: | - Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. - - !ruby/object:Api::Type::String - name: 'password' - required: true - input: true - description: | - Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. - This field is not returned on request, and the value is encrypted when stored in Database Migration Service. - - !ruby/object:Api::Type::Boolean - name: 'passwordSet' - output: true - description: | - Output only. Indicates If this connection profile password is stored. - - !ruby/object:Api::Type::NestedObject - name: 'ssl' - description: | - SSL configuration for the destination to connect to the source database. - properties: - - !ruby/object:Api::Type::Enum - name: 'type' - output: true - description: | - The current connection profile state. - values: - - :SERVER_ONLY - - :SERVER_CLIENT - - !ruby/object:Api::Type::String - name: 'clientKey' - input: true - description: | - Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. - If this field is used then the 'clientCertificate' field is mandatory. - - !ruby/object:Api::Type::String - name: 'clientCertificate' - input: true - description: | - Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. - If this field is used then the 'clientKey' field is mandatory - - !ruby/object:Api::Type::String - name: 'caCertificate' - input: true - required: true - description: | - Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. - The replica will use this certificate to verify it's connecting to the right host. - - !ruby/object:Api::Type::String - name: 'cloudSqlId' - description: | - If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. - - !ruby/object:Api::Type::NestedObject - name: 'postgresql' - description: | - Specifies connection parameters required specifically for PostgreSQL databases. - exactly_one_of: - - mysql - - postgresql - - cloudsql - - alloydb - properties: - - !ruby/object:Api::Type::String - name: 'host' - required: true - description: | - Required. The IP or hostname of the source MySQL database. - - !ruby/object:Api::Type::Integer - name: 'port' - required: true - description: | - Required. The network port of the source MySQL database. - - !ruby/object:Api::Type::String - name: 'username' - required: true - description: | - Required. The username that Database Migration Service will use to connect to the database. The value is encrypted when stored in Database Migration Service. - - !ruby/object:Api::Type::String - name: 'password' - required: true - input: true - description: | - Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. - This field is not returned on request, and the value is encrypted when stored in Database Migration Service. - - !ruby/object:Api::Type::Boolean - name: 'passwordSet' - output: true - description: | - Output only. Indicates If this connection profile password is stored. - - !ruby/object:Api::Type::NestedObject - name: 'ssl' - description: | - SSL configuration for the destination to connect to the source database. - properties: - - !ruby/object:Api::Type::Enum - name: 'type' - output: true - description: | - The current connection profile state. - values: - - :SERVER_ONLY - - :SERVER_CLIENT - - !ruby/object:Api::Type::String - name: 'clientKey' - input: true - required_with: - - client_certificate - description: | - Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. - If this field is used then the 'clientCertificate' field is mandatory. - - !ruby/object:Api::Type::String - name: 'clientCertificate' - input: true - required_with: - - client_key - description: | - Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. - If this field is used then the 'clientKey' field is mandatory - - !ruby/object:Api::Type::String - name: 'caCertificate' - input: true - required: true - description: | - Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. - The replica will use this certificate to verify it's connecting to the right host. - - !ruby/object:Api::Type::String - name: 'cloudSqlId' - description: | - If the source is a Cloud SQL database, use this field to provide the Cloud SQL instance ID of the source. - - !ruby/object:Api::Type::Enum - name: 'networkArchitecture' - output: true - description: | - Output only. If the source is a Cloud SQL database, this field indicates the network architecture it's associated with. - values: - - :NETWORK_ARCHITECTURE_OLD_CSQL_PRODUCER - - :NETWORK_ARCHITECTURE_NEW_CSQL_PRODUCER - - !ruby/object:Api::Type::NestedObject - - !ruby/object:Api::Type::NestedObject - name: 'cloudsql' - description: | - Specifies required connection parameters, and, optionally, the parameters required to create a Cloud SQL destination database instance. - exactly_one_of: - - mysql - - postgresql - - cloudsql - - alloydb - properties: - - !ruby/object:Api::Type::String - name: 'cloudSqlId' - output: true - description: | - Output only. The Cloud SQL instance ID that this connection profile is associated with. - - !ruby/object:Api::Type::NestedObject - name: 'settings' - description: | - Immutable. Metadata used to create the destination Cloud SQL database. - properties: - - !ruby/object:Api::Type::String - name: 'databaseVersion' - description: | - The database engine type and version. - Currently supported values located at https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles#sqldatabaseversion - - !ruby/object:Api::Type::KeyValuePairs - name: 'userLabels' - description: | - The resource labels for a Cloud SQL instance to use to annotate any related underlying resources such as Compute Engine VMs. - - !ruby/object:Api::Type::String - name: 'tier' - description: | - The tier (or machine type) for this instance, for example: db-n1-standard-1 (MySQL instances) or db-custom-1-3840 (PostgreSQL instances). - For more information, see https://cloud.google.com/sql/docs/mysql/instance-settings - - !ruby/object:Api::Type::String - name: 'storageAutoResizeLimit' - description: | - The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit. - - !ruby/object:Api::Type::Enum - name: 'activationPolicy' - description: | - The activation policy specifies when the instance is activated; it is applicable only when the instance state is 'RUNNABLE'. - values: - - :ALWAYS - - :NEVER - - !ruby/object:Api::Type::NestedObject - name: 'ipConfig' - description: | - The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address cannot be disabled. - properties: - - !ruby/object:Api::Type::Boolean - name: 'enableIpv4' - description: | - Whether the instance should be assigned an IPv4 address or not. - - !ruby/object:Api::Type::String - name: 'privateNetwork' - description: | - The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, projects/myProject/global/networks/default. - This setting can be updated, but it cannot be removed after it is set. - - !ruby/object:Api::Type::Boolean - name: 'requireSsl' - description: | - Whether SSL connections over IP should be enforced or not. - - !ruby/object:Api::Type::Array - name: 'authorizedNetworks' - description: | - The list of external networks that are allowed to connect to the instance using the IP. - item_type: !ruby/object:Api::Type::NestedObject - properties: - - !ruby/object:Api::Type::String - name: 'value' - description: | - The allowlisted value for the access control list. - required: true - - !ruby/object:Api::Type::String - name: 'label' - description: | - A label to identify this entry. - - !ruby/object:Api::Type::Time - name: 'expireTime' - exactly_one_of: - - expire_time - - ttl - description: | - The time when this access control entry expires in RFC 3339 format. - - !ruby/object:Api::Type::Time - name: 'ttl' - input: true - description: | - Input only. The time-to-leave of this access control entry. - - !ruby/object:Api::Type::Boolean - name: 'autoStorageIncrease' - description: | - If you enable this setting, Cloud SQL checks your available storage every 30 seconds. If the available storage falls below a threshold size, Cloud SQL automatically adds additional storage capacity. - If the available storage repeatedly falls below the threshold size, Cloud SQL continues to add storage until it reaches the maximum of 30 TB. - - !ruby/object:Api::Type::KeyValuePairs - name: 'databaseFlags' - description: | - The database flags passed to the Cloud SQL instance at startup. - - !ruby/object:Api::Type::Enum - name: 'dataDiskType' - description: | - The type of storage. - values: - - :PD_SSD - - :PD_HDD - - !ruby/object:Api::Type::String - name: 'dataDiskSizeGb' - description: | - The storage capacity available to the database, in GB. The minimum (and default) size is 10GB. - - !ruby/object:Api::Type::String - name: 'zone' - description: | - The Google Cloud Platform zone where your Cloud SQL datdabse instance is located. - - !ruby/object:Api::Type::String - name: 'sourceId' - required: true - description: | - The Database Migration Service source connection profile ID, in the format: projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID - - !ruby/object:Api::Type::String - name: 'rootPassword' - input: true - description: | - Input only. Initial root password. - - !ruby/object:Api::Type::Boolean - name: 'rootPasswordSet' - output: true - description: | - Output only. Indicates If this connection profile root password is stored. - - !ruby/object:Api::Type::String - name: 'collation' - description: | - The Cloud SQL default instance level collation. - - !ruby/object:Api::Type::String - name: 'cmekKeyName' - description: | - The KMS key name used for the csql instance. - - !ruby/object:Api::Type::String - name: 'privateIp' - output: true - description: | - Output only. The Cloud SQL database instance's private IP. - - !ruby/object:Api::Type::String - name: 'publicIp' - output: true - description: | - Output only. The Cloud SQL database instance's public IP. - - !ruby/object:Api::Type::NestedObject - name: 'alloydb' - description: | - Specifies required connection parameters, and the parameters required to create an AlloyDB destination cluster. - exactly_one_of: - - mysql - - postgresql - - cloudsql - - alloydb - properties: - - !ruby/object:Api::Type::String - name: 'clusterId' - required: true - description: | - Required. The AlloyDB cluster ID that this connection profile is associated with. - - !ruby/object:Api::Type::NestedObject - name: 'settings' - input: true - description: | - Immutable. Metadata used to create the destination AlloyDB cluster. - properties: - - !ruby/object:Api::Type::NestedObject - name: 'initialUser' - required: true - input: true - description: | - Required. Input only. Initial user to setup during cluster creation. - properties: - - !ruby/object:Api::Type::String - name: 'user' - required: true - description: | - The database username. - - !ruby/object:Api::Type::String - name: 'password' - required: true - description: | - The initial password for the user. - - !ruby/object:Api::Type::Boolean - name: 'passwordSet' - output: true - description: | - Output only. Indicates if the initialUser.password field has been set. - - !ruby/object:Api::Type::String - name: 'vpcNetwork' - required: true - description: | - Required. The resource link for the VPC network in which cluster resources are created and from which they are accessible via Private IP. The network must belong to the same project as the cluster. - It is specified in the form: 'projects/{project_number}/global/networks/{network_id}'. This is required to create a cluster. - - !ruby/object:Api::Type::KeyValuePairs - name: 'labels' - description: | - Labels for the AlloyDB cluster created by DMS. - - !ruby/object:Api::Type::NestedObject - name: 'primaryInstanceSettings' - description: | - Settings for the cluster's primary instance - properties: - - !ruby/object:Api::Type::String - name: 'id' - required: true - description: | - The database username. - - !ruby/object:Api::Type::NestedObject - name: 'machineConfig' - required: true - input: true - description: | - Configuration for the machines that host the underlying database engine. - properties: - - !ruby/object:Api::Type::Integer - name: 'cpuCount' - required: true - description: | - The number of CPU's in the VM instance. - - !ruby/object:Api::Type::KeyValuePairs - name: 'databaseFlags' - description: | - Database flags to pass to AlloyDB when DMS is creating the AlloyDB cluster and instances. See the AlloyDB documentation for how these can be used. - - !ruby/object:Api::Type::KeyValuePairs - name: 'labels' - description: | - Labels for the AlloyDB primary instance created by DMS. - - !ruby/object:Api::Type::String - name: 'privateIp' - output: true - description: | - Output only. The private IP address for the Instance. This is the connection endpoint for an end-user application. - - - \ No newline at end of file From 055f66f9eed682d27aca5a869664fd7cf483ccbb Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Wed, 15 Mar 2023 10:49:00 -0700 Subject: [PATCH 09/22] making suggested updates and corrections from reviewer -- adding output tags/removing unneeded fields --- .../connectionprofile.yaml | 37 +++++++++---------- ..._service_connection_profile.alloydb.tf.erb | 1 - ...service_connection_profile.cloudsql.tf.erb | 2 - ..._service_connection_profile.postgre.tf.erb | 1 - 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index 7e54c3025e50..5522c040e0a9 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -27,19 +27,20 @@ parameters: - !ruby/object:Api::Type::String name: 'connectionProfileId' required: true - input: true + immutable: true url_param_only: true description: | The ID of the connection profile. - !ruby/object:Api::Type::String name: 'location' - input: true + immutable: true url_param_only: true description: | The location where the connection profile should reside. properties: - !ruby/object:Api::Type::String name: 'name' + output: true description: | The name of this connection profile resource in the form of projects/{project}/locations/{location}/connectionProfiles/{connectionProfile}. - !ruby/object:Api::Type::String @@ -51,17 +52,13 @@ properties: output: true description: | Output only. The timestamp when the resource was created. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. - - !ruby/object:Api::Type::Time - name: 'updateime' - output: true - description: | - Output only. The timestamp when the resource was last updated. A timestamp in RFC3339 UTC 'Zulu' format, accurate to nanoseconds. Example: '2014-10-02T15:01:23.045123456Z'. - !ruby/object:Api::Type::KeyValuePairs name: 'labels' description: | The resource labels for connection profile to use to annotate any related underlying resources such as Compute Engine VMs. - !ruby/object:Api::Type::Enum name: 'state' + output: true description: | The current connection profile state. values: @@ -128,7 +125,7 @@ properties: - !ruby/object:Api::Type::String name: 'password' required: true - input: true + immutable: true description: | Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service. @@ -152,19 +149,19 @@ properties: - :SERVER_CLIENT - !ruby/object:Api::Type::String name: 'clientKey' - input: true + immutable: true description: | Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. If this field is used then the 'clientCertificate' field is mandatory. - !ruby/object:Api::Type::String name: 'clientCertificate' - input: true + immutable: true description: | Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. If this field is used then the 'clientKey' field is mandatory - !ruby/object:Api::Type::String name: 'caCertificate' - input: true + immutable: true required: true description: | Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. @@ -201,7 +198,7 @@ properties: - !ruby/object:Api::Type::String name: 'password' required: true - input: true + immutable: true description: | Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service. @@ -225,7 +222,7 @@ properties: - :SERVER_CLIENT - !ruby/object:Api::Type::String name: 'clientKey' - input: true + immutable: true required_with: - client_certificate description: | @@ -233,7 +230,7 @@ properties: If this field is used then the 'clientCertificate' field is mandatory. - !ruby/object:Api::Type::String name: 'clientCertificate' - input: true + immutable: true required_with: - client_key description: | @@ -241,7 +238,7 @@ properties: If this field is used then the 'clientKey' field is mandatory - !ruby/object:Api::Type::String name: 'caCertificate' - input: true + immutable: true required: true description: | Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. @@ -346,7 +343,7 @@ properties: The time when this access control entry expires in RFC 3339 format. - !ruby/object:Api::Type::Time name: 'ttl' - input: true + immutable: true description: | Input only. The time-to-leave of this access control entry. - !ruby/object:Api::Type::Boolean @@ -380,7 +377,7 @@ properties: The Database Migration Service source connection profile ID, in the format: projects/my_project_name/locations/us-central1/connectionProfiles/connection_profile_ID - !ruby/object:Api::Type::String name: 'rootPassword' - input: true + immutable: true description: | Input only. Initial root password. - !ruby/object:Api::Type::Boolean @@ -423,14 +420,14 @@ properties: Required. The AlloyDB cluster ID that this connection profile is associated with. - !ruby/object:Api::Type::NestedObject name: 'settings' - input: true + immutable: true description: | Immutable. Metadata used to create the destination AlloyDB cluster. properties: - !ruby/object:Api::Type::NestedObject name: 'initialUser' required: true - input: true + immutable: true description: | Required. Input only. Initial user to setup during cluster creation. properties: @@ -472,7 +469,7 @@ properties: - !ruby/object:Api::Type::NestedObject name: 'machineConfig' required: true - input: true + immutable: true description: | Configuration for the machines that host the underlying database engine. properties: diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb index 59887f631b39..21f7cb6a2b38 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb @@ -23,7 +23,6 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar location = "us-central1" connection_profile_id = "<%= ctx[:vars]["alloydb_cp"] %>" display_name = "<%= ctx[:vars]["alloydb_cp"] %>_display" - name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["alloydb_cp"] %>" dbprovider = "ALLOYDB" labels = { testanno = "testanno" 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 a083564e2c55..8ba2ce56d8ef 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 @@ -27,7 +27,6 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar location = "us-central1" connection_profile_id = "<%= ctx[:vars]["cloudsqldb_from_profile"] %>" display_name = "<%= ctx[:vars]["cloudsqldb_from_profile"] %>_display" - name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["cloudsqldb_from_profile"] %>" labels = { testanno = "testanno" } @@ -53,7 +52,6 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar location = "us-central1" connection_profile_id = "<%= ctx[:vars]["cloudsqldb_to_profile"] %>" display_name = "<%= ctx[:vars]["cloudsqldb_to_profile"] %>_displayname" - name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["cloudsqldb_to_profile"] %>" dbprovider = "CLOUDSQL" labels = { testlabela = "testlabelb" diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb index 136aa601a200..a94d65290f5c 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb @@ -26,7 +26,6 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar location = "us-central1" connection_profile_id = "<%= ctx[:vars]["postgresql_cp"] %>" display_name = "<%= ctx[:vars]["postgresql_cp"] %>_display" - name = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["postgresql_cp"] %>" labels = { testanno = "testanno" } From aef2f2a0e71decc9460d141874907c5e4c1e7c1b Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 17 Mar 2023 15:19:06 -0700 Subject: [PATCH 10/22] Merged terraform.yaml to resource yaml, added examples --- .../connectionprofile.yaml | 45 +++++++++++++++++ .../databasemigrationservice/terraform.yaml | 49 ------------------- ..._service_connection_profile.postgre.tf.erb | 46 ----------------- ...service_connection_profile_alloydb.tf.erb} | 6 +-- ...ervice_connection_profile_cloudsql.tf.erb} | 40 +++++++-------- ..._service_connection_profile_postgre.tf.erb | 46 +++++++++++++++++ 6 files changed, 114 insertions(+), 118 deletions(-) delete mode 100644 mmv1/products/databasemigrationservice/terraform.yaml delete mode 100644 mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb rename mmv1/templates/terraform/examples/{database_migration_service_connection_profile.alloydb.tf.erb => database_migration_service_connection_profile_alloydb.tf.erb} (88%) rename mmv1/templates/terraform/examples/{database_migration_service_connection_profile.cloudsql.tf.erb => database_migration_service_connection_profile_cloudsql.tf.erb} (55%) create mode 100644 mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index 5522c040e0a9..5340054a5d85 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -23,6 +23,31 @@ references: !ruby/object:Api::Resource::ReferenceLinks guides: 'Database Migration': 'https://cloud.google.com/database-migration/docs/' api: 'https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create' +examples: + - !ruby/object:Provider::Terraform::Examples + name: "database_migration_service_connection_profile_cloudsql" + primary_resource_id: "cloudsqlprofile" + vars: + sqldb: "my-database" + sqldb_cert: "my-cert" + sqldb_user: "my-username" + sqldb_pass: "my-password" + from_profile: "my-fromprofileid" + to_profile: "my-toprofileid" + - !ruby/object:Provider::Terraform::Examples + name: "database_migration_service_connection_profile_postgre" + primary_resource_id: "postgreprofile" + vars: + sqldb: "my-database" + sqldb_cert: "my-cert" + sqldb_user: "my-username" + sqldb_pass: "my-password" + profile: "my-profileid" + - !ruby/object:Provider::Terraform::Examples + name: "database_migration_service_connection_profile_alloydb" + primary_resource_id: "alloydbprofile" + vars: + profile: "my-profileid" parameters: - !ruby/object:Api::Type::String name: 'connectionProfileId' @@ -129,6 +154,8 @@ properties: description: | Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service. + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.erb - !ruby/object:Api::Type::Boolean name: 'passwordSet' output: true @@ -153,16 +180,22 @@ properties: description: | Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. If this field is used then the 'clientCertificate' field is mandatory. + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.erb - !ruby/object:Api::Type::String name: 'clientCertificate' immutable: true description: | Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. If this field is used then the 'clientKey' field is mandatory + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.erb - !ruby/object:Api::Type::String name: 'caCertificate' immutable: true required: true + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.erb description: | Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. The replica will use this certificate to verify it's connecting to the right host. @@ -202,6 +235,8 @@ properties: description: | Required. Input only. The password for the user that Database Migration Service will be using to connect to the database. This field is not returned on request, and the value is encrypted when stored in Database Migration Service. + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.erb - !ruby/object:Api::Type::Boolean name: 'passwordSet' output: true @@ -228,6 +263,8 @@ properties: description: | Input only. The unencrypted PKCS#1 or PKCS#8 PEM-encoded private key associated with the Client Certificate. If this field is used then the 'clientCertificate' field is mandatory. + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.erb - !ruby/object:Api::Type::String name: 'clientCertificate' immutable: true @@ -236,10 +273,14 @@ properties: description: | Input only. The x509 PEM-encoded certificate that will be used by the replica to authenticate against the source database server. If this field is used then the 'clientKey' field is mandatory + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.erb - !ruby/object:Api::Type::String name: 'caCertificate' immutable: true required: true + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.erb description: | Required. Input only. The x509 PEM-encoded certificate of the CA that signed the source database server's certificate. The replica will use this certificate to verify it's connecting to the right host. @@ -378,6 +419,8 @@ properties: - !ruby/object:Api::Type::String name: 'rootPassword' immutable: true + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.erb description: | Input only. Initial root password. - !ruby/object:Api::Type::Boolean @@ -439,6 +482,8 @@ properties: - !ruby/object:Api::Type::String name: 'password' required: true + sensitive: true + custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.erb description: | The initial password for the user. - !ruby/object:Api::Type::Boolean diff --git a/mmv1/products/databasemigrationservice/terraform.yaml b/mmv1/products/databasemigrationservice/terraform.yaml deleted file mode 100644 index 1dee22e89865..000000000000 --- a/mmv1/products/databasemigrationservice/terraform.yaml +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2022 Google Inc. -# 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. - ---- !ruby/object:Provider::Terraform::Config -overrides: !ruby/object:Overrides::ResourceOverrides - ConnectionProfile: !ruby/object:Overrides::Terraform::ResourceOverride - properties: - state: !ruby/object:Overrides::Terraform::PropertyOverride - default_from_api: true - mysql.password: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_password.go.erb - mysql.ssl.clientKey: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_key.go.erb - mysql.ssl.clientCertificate: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_client_certificate.go.erb - mysql.ssl.caCertificate: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_mysql_ssl_ca_certificate.go.erb - postgresql.password: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_password.go.erb - postgresql.ssl.clientKey: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_key.go.erb - postgresql.ssl.clientCertificate: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_client_certificate.go.erb - postgresql.ssl.caCertificate: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_postgresql_ssl_ca_certificate.go.erb - cloudsql.settings.rootPassword: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_cloudsql_settings_root_password.go.erb - alloydb.settings.initialUser.password: !ruby/object:Overrides::Terraform::PropertyOverride - sensitive: true - custom_flatten: templates/terraform/custom_flatten/database_migration_service_connection_profile_alloydb_settings_initial_user_password.go.erb \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb deleted file mode 100644 index a94d65290f5c..000000000000 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.postgre.tf.erb +++ /dev/null @@ -1,46 +0,0 @@ -resource "google_sql_database_instance" "postgresqldb" { - name = "<%= ctx[:vars]["postgresqldb"] %>" - database_version = "POSTGRES_12" - settings { - tier = "db-custom-2-13312" - } -} - -resource "google_sql_ssl_cert" "postgresql_client_cert" { - common_name = "<%= ctx[:vars]["postgresqldb_cert"] %>" - instance = google_sql_database_instance.postgresqldb.name - - depends_on = [google_sql_database_instance.postgresqldb] -} - -resource "google_sql_user" "postgresql_user" { - name = "<%= ctx[:vars]["postgresqldb_user"] %>" - instance = google_sql_database_instance.postgresqldb.name - password = "<%= ctx[:vars]["postgresqldb_pass"] %>" - - - depends_on = [google_sql_database_instance.postgresqldb] -} - -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { - location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["postgresql_cp"] %>" - display_name = "<%= ctx[:vars]["postgresql_cp"] %>_display" - labels = { - testanno = "testanno" - } - postgresql { - host = google_sql_database_instance.postgresqldb.ip_address.0.ip_address - port = 5432 - username = "testusernamepostgre" - password = "testpasswordpostgre" - ssl { - client_key = google_sql_ssl_cert.postgresql_client_cert.private_key - client_certificate = google_sql_ssl_cert.postgresql_client_cert.cert - ca_certificate = google_sql_ssl_cert.postgresql_client_cert.server_ca_cert - } - cloud_sql_id = "postgresqldb" - - } - depends_on = [google_sql_database_instance.postgresqldb] -} diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb similarity index 88% rename from mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb rename to mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb index 21f7cb6a2b38..eb7b267b49a5 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile.alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb @@ -15,14 +15,14 @@ resource "google_service_networking_connection" "vpc_connection" { network = google_compute_network.default.id service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] - depends_on = [google_compute_network.default] + depends_on = [google_compute_global_address.private_ip_alloc] } resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["alloydb_cp"] %>" - display_name = "<%= ctx[:vars]["alloydb_cp"] %>_display" + connection_profile_id = "<%= ctx[:vars]["profile"] %>" + display_name = "<%= ctx[:vars]["profile"] %>_display" dbprovider = "ALLOYDB" labels = { testanno = "testanno" 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 similarity index 55% rename from mmv1/templates/terraform/examples/database_migration_service_connection_profile.cloudsql.tf.erb rename to mmv1/templates/terraform/examples/database_migration_service_connection_profile_cloudsql.tf.erb index 8ba2ce56d8ef..43752b74f488 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 @@ -1,57 +1,57 @@ resource "google_sql_database_instance" "cloudsqldb" { - name = "<%= ctx[:vars]["cloudsqldb"] %>" + name = "<%= ctx[:vars]["sqldb"] %>" database_version = "MYSQL_5_7" settings { tier = "db-n1-standard-1" } } -resource "google_sql_ssl_cert" "cloudsqldb_client_cert" { - common_name = "<%= ctx[:vars]["cloudsqldb_cert"] %>" +resource "google_sql_ssl_cert" "sql_client_cert" { + common_name = "<%= ctx[:vars]["sqldb_cert"] %>" instance = google_sql_database_instance.cloudsqldb.name depends_on = [google_sql_database_instance.cloudsqldb] } -resource "google_sql_user" "coudsqldb_user" { - name = "<%= ctx[:vars]["cloudsqldb_user"] %>" +resource "google_sql_user" "sqldb_user" { + name = "<%= ctx[:vars]["sqldb_user"] %>" instance = google_sql_database_instance.cloudsqldb.name - password = "<%= ctx[:vars]["cloudsqldb_pass"] %>" + password = "<%= ctx[:vars]["sqldb_pass"] %>" - depends_on = [google_sql_database_instance.cloudsqldb] + depends_on = [google_sql_ssl_cert.sql_client_cert] } resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["cloudsqldb_from_profile"] %>" - display_name = "<%= ctx[:vars]["cloudsqldb_from_profile"] %>_display" + connection_profile_id = "<%= ctx[:vars]["from_profile"] %>" + display_name = "<%= ctx[:vars]["from_profile"] %>_display" labels = { testanno = "testanno" } mysql { host = google_sql_database_instance.main.ip_address.0.ip_address port = 3306 - username = "testusernamecloudsql" - password = "testpasswordcloudsql" + username = google_sql_user.sqldb_user.name + password = google_sql_user.sqldb_user.password ssl { - client_key = google_sql_ssl_cert.cloudsqldb_client_cert.private_key - client_certificate = google_sql_ssl_cert.cloudsqldb_client_cert.cert - ca_certificate = google_sql_ssl_cert.cloudsqldb_client_cert.server_ca_cert + 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 } - cloud_sql_id = "<%= ctx[:vars]["cloudsqldb"] %>" + cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" } dbprovider = "CLOUDSQL" - depends_on = [google_sql_database_instance.cloudsqldb] + depends_on = [google_sql_user.sql_user] } resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["cloudsqldb_to_profile"] %>" - display_name = "<%= ctx[:vars]["cloudsqldb_to_profile"] %>_displayname" + connection_profile_id = "<%= ctx[:vars]["to_profile"] %>" + display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" dbprovider = "CLOUDSQL" labels = { testlabela = "testlabelb" @@ -77,11 +77,11 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar data_disk_type = "PD_HDD" data_disk_size_gb = "11" zone = "us-central1-b" - source_id = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["cloudsqldb_from_profile"] %>" + source_id = "projects/${data.google_project.project.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["sqldb_from_profile"] %>" root_password = "testpasscloudsql" } - depends_on = [google_sql_database_instance.main] + depends_on = [google_database_migration_service_connection_profile.<%= ctx[:primary_resource_id] %>] } } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb new file mode 100644 index 000000000000..2ae624d9abea --- /dev/null +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb @@ -0,0 +1,46 @@ +resource "google_sql_database_instance" "postgresqldb" { + name = "<%= ctx[:vars]["sqldb"] %>" + database_version = "POSTGRES_12" + settings { + tier = "db-custom-2-13312" + } +} + +resource "google_sql_ssl_cert" "sql_client_cert" { + common_name = "<%= ctx[:vars]["sqldb_cert"] %>" + instance = google_sql_database_instance.postgresqldb.name + + depends_on = [google_sql_database_instance.postgresqldb] +} + +resource "google_sql_user" "sql_user" { + name = "<%= ctx[:vars]["sqldb_user"] %>" + instance = google_sql_database_instance.postgresqldb.name + password = "<%= ctx[:vars]["sqldb_pass"] %>" + + + depends_on = [google_sql_ssl_cert.sql_client_cert] +} + +resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["profile"] %>" + display_name = "<%= ctx[:vars]["profile"] %>_display" + labels = { + testanno = "testanno" + } + postgresql { + host = google_sql_database_instance.postgresqldb.ip_address.0.ip_address + port = 5432 + 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_certificate = google_sql_ssl_cert.sql_client_cert.cert + ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert + } + cloud_sql_id = "postgresqldb" + + } + depends_on = [google_sql_user.sql_user] +} From 47d3c4c108e31499ce89682f36f1c1f3cf5ae1d3 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Wed, 5 Apr 2023 15:51:46 -0700 Subject: [PATCH 11/22] updated tests for errors --- ..._service_connection_profile_alloydb.tf.erb | 8 ++++++-- ...service_connection_profile_cloudsql.tf.erb | 19 ++++++++++--------- ..._service_connection_profile_postgre.tf.erb | 7 ++++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb index eb7b267b49a5..0b6a7ec551c8 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb @@ -1,5 +1,9 @@ +data "google_project" "project" { +} + resource "google_compute_network" "default" { - name = "default" + provider = google-beta + name = "tf-test-workstation-cluster%{random_suffix}" } resource "google_compute_global_address" "private_ip_alloc" { @@ -34,7 +38,7 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar user = "alloyuser" password = "alloypass" } - vpc_network = "projects/${data.google_project.project.number}/global/networks/default" + vpc_network = "projects/${data.google_project.project.project_id}/global/networks/default" labels = { testalloylabela = "testalloylabelb" } 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 43752b74f488..2148d2a76ac8 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 @@ -1,9 +1,14 @@ +data "google_project" "project" { +} + resource "google_sql_database_instance" "cloudsqldb" { name = "<%= ctx[:vars]["sqldb"] %>" database_version = "MYSQL_5_7" settings { tier = "db-n1-standard-1" + deletion_protection_enabled = false } + deletion_protection = false } resource "google_sql_ssl_cert" "sql_client_cert" { @@ -31,7 +36,7 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar testanno = "testanno" } mysql { - host = google_sql_database_instance.main.ip_address.0.ip_address + 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 @@ -44,11 +49,11 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar } dbprovider = "CLOUDSQL" - depends_on = [google_sql_user.sql_user] + depends_on = [google_sql_user.sqldb_user] } -resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { +resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>_destination" { location = "us-central1" connection_profile_id = "<%= ctx[:vars]["to_profile"] %>" display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" @@ -68,20 +73,16 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar ip_config { enable_ipv4 = true require_ssl = "true" - authorized_networks { - value = google_sql_database_instance.cloudsqldb.ip_address.0.ip_address - label = "testlabel" - } } 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.number}/locations/us-central1/connectionProfiles/<%= ctx[:vars]["sqldb_from_profile"] %>" + 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] %>] } + depends_on = [google_database_migration_service_connection_profile.<%= ctx[:primary_resource_id] %>] } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb index 2ae624d9abea..8515a6911417 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb @@ -4,6 +4,7 @@ resource "google_sql_database_instance" "postgresqldb" { settings { tier = "db-custom-2-13312" } + deletion_protection = false } resource "google_sql_ssl_cert" "sql_client_cert" { @@ -13,7 +14,7 @@ resource "google_sql_ssl_cert" "sql_client_cert" { depends_on = [google_sql_database_instance.postgresqldb] } -resource "google_sql_user" "sql_user" { +resource "google_sql_user" "sqldb_user" { name = "<%= ctx[:vars]["sqldb_user"] %>" instance = google_sql_database_instance.postgresqldb.name password = "<%= ctx[:vars]["sqldb_pass"] %>" @@ -39,8 +40,8 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar client_certificate = google_sql_ssl_cert.sql_client_cert.cert ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert } - cloud_sql_id = "postgresqldb" + cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" } - depends_on = [google_sql_user.sql_user] + depends_on = [google_sql_user.sqldb_user] } From 2d9d109a38f49e0f65a3fb95a525211901497306 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Mon, 10 Apr 2023 11:11:09 -0700 Subject: [PATCH 12/22] Updates made to examples, in progress (failing) handwritten update test --- .../connectionprofile.yaml | 22 +++++++++++++++++++ ..._service_connection_profile_alloydb.tf.erb | 8 +++---- ...service_connection_profile_cloudsql.tf.erb | 2 -- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index 5340054a5d85..d5308d375ce5 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -23,6 +23,27 @@ references: !ruby/object:Api::Resource::ReferenceLinks guides: 'Database Migration': 'https://cloud.google.com/database-migration/docs/' api: 'https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.connectionProfiles/create' +async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + path: "name" + base_url: "{{op_id}}" + wait_ms: 1000 + timeouts: !ruby/object:Api::Timeouts + insert_minutes: 60 + update_minutes: 60 + delete_minutes: 60 + result: !ruby/object:Api::OpAsync::Result + path: "response" + status: !ruby/object:Api::OpAsync::Status + path: "done" + complete: true + allowed: + - true + - false + error: !ruby/object:Api::OpAsync::Error + path: "error" + message: "message" +autogen_async: true examples: - !ruby/object:Provider::Terraform::Examples name: "database_migration_service_connection_profile_cloudsql" @@ -114,6 +135,7 @@ properties: output: true - !ruby/object:Api::Type::Enum name: 'dbprovider' + output: true description: | The database provider. api_name: provider diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb index 0b6a7ec551c8..d6fae5c653ae 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb @@ -2,12 +2,11 @@ data "google_project" "project" { } resource "google_compute_network" "default" { - provider = google-beta - name = "tf-test-workstation-cluster%{random_suffix}" + name = "tf-test-alloydb-cp%{random_suffix}" } resource "google_compute_global_address" "private_ip_alloc" { - name = "private_ip_alloc" + name = "private-ip-alloc%{random_suffix}" address_type = "INTERNAL" purpose = "VPC_PEERING" prefix_length = 16 @@ -27,7 +26,6 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar location = "us-central1" connection_profile_id = "<%= ctx[:vars]["profile"] %>" display_name = "<%= ctx[:vars]["profile"] %>_display" - dbprovider = "ALLOYDB" labels = { testanno = "testanno" } @@ -38,7 +36,7 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar user = "alloyuser" password = "alloypass" } - vpc_network = "projects/${data.google_project.project.project_id}/global/networks/default" + vpc_network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}" labels = { testalloylabela = "testalloylabelb" } 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 2148d2a76ac8..fc5b26735458 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 @@ -47,7 +47,6 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar } cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" } - dbprovider = "CLOUDSQL" depends_on = [google_sql_user.sqldb_user] } @@ -57,7 +56,6 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar location = "us-central1" connection_profile_id = "<%= ctx[:vars]["to_profile"] %>" display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" - dbprovider = "CLOUDSQL" labels = { testlabela = "testlabelb" } From a41da100cf913b8f373eb4085bb7e91beec98a0d Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Mon, 10 Apr 2023 11:19:06 -0700 Subject: [PATCH 13/22] added handwritten test missing from previous commit --- ...gration_service_connection_profile_test.go | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go new file mode 100644 index 000000000000..2cec61634186 --- /dev/null +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -0,0 +1,76 @@ +package google + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { + t.Parallel() + + suffix := map[string]interface{}{ + "random_suffix": RandString(t, 10), + } + + VcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDatabaseMigrationServiceConnectionProfile_basic(suffix), + }, + { + ResourceName: "google_database_migration_service_connection_profile.default", + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccDatabaseMigrationServiceConnectionProfile_update(suffix), + }, + { + ResourceName: "google_database_migration_service_connection_profile.default", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccDatabaseMigrationServiceConnectionProfile_basic(context map[string]interface{}) string { + return Nprintf(` +resource "google_database_migration_service_connection_profile" "default" { + location = "us-central1" + connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" + display_name = "tf-test-dbms-connection-profile-display%{random_suffix}" + labels = { + testanno = "testanno" + } + mysql { + host = "10.20.30.40" + port = 3306 + username = "tf-test-dbms-test-user%{random_suffix}" + password = "tf-test-dbms-test-pass%{random_suffix}" + } +} +`, context) +} + +func testAccDatabaseMigrationServiceConnectionProfile_update(context map[string]interface{}) string { + return Nprintf(` +resource "google_database_migration_service_connection_profile" "default" { + location = "us-central1" + connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" + display_name = "tf-test-dbms-connection-profile-display%{random_suffix}" + labels = { + testanno = "testanno" + } + mysql { + host = "10.20.30.50" + port = 3306 + username = "tf-test-update-dbms-test-user%{random_suffix}" + password = "tf-test-update-dbms-test-pass%{random_suffix}" + } +} +`, context) +} From 8459f969392dd739576925a1d606f118576b9fb7 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Tue, 11 Apr 2023 16:47:30 -0700 Subject: [PATCH 14/22] rebasing and updating testAccPreCheck to AccTestPreCheck --- ...source_database_migration_service_connection_profile_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index 2cec61634186..db0ad9494455 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -14,7 +14,7 @@ func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { } VcrTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { AccTestPreCheck(t) }, ProtoV5ProviderFactories: ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { From 10308de1e3a42c5f3d3907152a0b6ca7b7863e3a Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Wed, 12 Apr 2023 10:05:38 -0700 Subject: [PATCH 15/22] resolved update test issue, added import format --- mmv1/products/databasemigrationservice/connectionprofile.yaml | 1 + ...source_database_migration_service_connection_profile_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index d5308d375ce5..b5cc29c5204e 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -14,6 +14,7 @@ --- !ruby/object:Api::Resource name: 'ConnectionProfile' self_link: 'projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}' +import_format: ["projects/{{project}}/locations/{{location}}/connectionProfiles/{{connection_profile_id}}"] base_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles' create_url: 'projects/{{project}}/locations/{{location}}/connectionProfiles?connectionProfileId={{connection_profile_id}}' update_verb: :PATCH diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index db0ad9494455..efb947eb9146 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -24,6 +24,7 @@ func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { ResourceName: "google_database_migration_service_connection_profile.default", ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_profile_id", "location", "mysql.0.password"}, }, { Config: testAccDatabaseMigrationServiceConnectionProfile_update(suffix), @@ -32,6 +33,7 @@ func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { ResourceName: "google_database_migration_service_connection_profile.default", ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"connection_profile_id", "location", "mysql.0.password"}, }, }, }) From 54084bbaa03d41c080b9d9574a0de6e46e14e97f Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Wed, 12 Apr 2023 10:25:32 -0700 Subject: [PATCH 16/22] go fmt --- ...base_migration_service_connection_profile_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index efb947eb9146..dc0b8d5129ae 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -21,18 +21,18 @@ func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { Config: testAccDatabaseMigrationServiceConnectionProfile_basic(suffix), }, { - ResourceName: "google_database_migration_service_connection_profile.default", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_database_migration_service_connection_profile.default", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"connection_profile_id", "location", "mysql.0.password"}, }, { Config: testAccDatabaseMigrationServiceConnectionProfile_update(suffix), }, { - ResourceName: "google_database_migration_service_connection_profile.default", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_database_migration_service_connection_profile.default", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"connection_profile_id", "location", "mysql.0.password"}, }, }, From e47cf515b21c25c806be63648c7a0c8efc359c38 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Thu, 13 Apr 2023 12:15:29 -0700 Subject: [PATCH 17/22] copyright notice, adding ignore_read_extra per fix for nested sensitive fields https://github.com/hashicorp/terraform-provider-google/issues/12410 --- .../databasemigrationservice/connectionprofile.yaml | 12 ++++++++++++ mmv1/products/databasemigrationservice/product.yaml | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index b5cc29c5204e..a0573655dc10 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -49,6 +49,11 @@ examples: - !ruby/object:Provider::Terraform::Examples name: "database_migration_service_connection_profile_cloudsql" primary_resource_id: "cloudsqlprofile" + ignore_read_extra: + - "mysql.0.password" + - "mysql.0.ssl.0.ca_certificate" + - "mysql.0.ssl.0.client_certificate" + - "mysql.0.ssl.0.client_key" vars: sqldb: "my-database" sqldb_cert: "my-cert" @@ -59,6 +64,11 @@ examples: - !ruby/object:Provider::Terraform::Examples name: "database_migration_service_connection_profile_postgre" primary_resource_id: "postgreprofile" + ignore_read_extra: + - "postgresql.0.password" + - "postgresql.0.ssl.0.ca_certificate" + - "postgresql.0.ssl.0.client_certificate" + - "postgresql.0.ssl.0.client_key" vars: sqldb: "my-database" sqldb_cert: "my-cert" @@ -68,6 +78,8 @@ examples: - !ruby/object:Provider::Terraform::Examples name: "database_migration_service_connection_profile_alloydb" primary_resource_id: "alloydbprofile" + ignore_read_extra: + - "alloydb.0.settings.0.initial_user.0.password" vars: profile: "my-profileid" parameters: diff --git a/mmv1/products/databasemigrationservice/product.yaml b/mmv1/products/databasemigrationservice/product.yaml index f95c8510af7b..c0cc8a0d2495 100644 --- a/mmv1/products/databasemigrationservice/product.yaml +++ b/mmv1/products/databasemigrationservice/product.yaml @@ -1,3 +1,16 @@ +# Copyright 2022 Google Inc. +# 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. + --- !ruby/object:Api::Product name: DatabaseMigrationService display_name: DatabaseMigrationService From 5fd01af6144b135b6a02bcccc29353eaa224b357 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Thu, 13 Apr 2023 13:59:14 -0700 Subject: [PATCH 18/22] changing hard coded cluster name to variable --- ...base_migration_service_connection_profile_alloydb.tf.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb index d6fae5c653ae..4e1e0cfea1f7 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb @@ -30,11 +30,11 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar testanno = "testanno" } alloydb { - cluster_id = "dbmsalloycluster" + cluster_id = "dbmsalloycluster%{random_suffix}" settings { initial_user { - user = "alloyuser" - password = "alloypass" + user = "alloyuser%{random_suffix}" + password = "alloypass%{random_suffix}" } vpc_network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}" labels = { From 09ee05fc4273da1e7af279671a4f4d12ffbceac8 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Thu, 20 Apr 2023 11:29:56 -0700 Subject: [PATCH 19/22] suggested formatting fixes/minor update test functionality update --- .../connectionprofile.yaml | 5 +- ..._service_connection_profile_alloydb.tf.erb | 64 ++++++------ ...service_connection_profile_cloudsql.tf.erb | 98 +++++++++---------- ..._service_connection_profile_postgre.tf.erb | 43 ++++---- ...gration_service_connection_profile_test.go | 6 +- 5 files changed, 109 insertions(+), 107 deletions(-) diff --git a/mmv1/products/databasemigrationservice/connectionprofile.yaml b/mmv1/products/databasemigrationservice/connectionprofile.yaml index a0573655dc10..0b40c6a8abf8 100644 --- a/mmv1/products/databasemigrationservice/connectionprofile.yaml +++ b/mmv1/products/databasemigrationservice/connectionprofile.yaml @@ -62,8 +62,8 @@ examples: from_profile: "my-fromprofileid" to_profile: "my-toprofileid" - !ruby/object:Provider::Terraform::Examples - name: "database_migration_service_connection_profile_postgre" - primary_resource_id: "postgreprofile" + name: "database_migration_service_connection_profile_postgres" + primary_resource_id: "postgresprofile" ignore_read_extra: - "postgresql.0.password" - "postgresql.0.ssl.0.ca_certificate" @@ -349,6 +349,7 @@ properties: Output only. The Cloud SQL instance ID that this connection profile is associated with. - !ruby/object:Api::Type::NestedObject name: 'settings' + immutable: true description: | Immutable. Metadata used to create the destination Cloud SQL database. properties: diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb index 4e1e0cfea1f7..e425ab1d86a7 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb @@ -11,48 +11,50 @@ resource "google_compute_global_address" "private_ip_alloc" { purpose = "VPC_PEERING" prefix_length = 16 network = google_compute_network.default.id - depends_on = [google_compute_network.default] + + depends_on = [google_compute_network.default] } resource "google_service_networking_connection" "vpc_connection" { network = google_compute_network.default.id service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] + depends_on = [google_compute_global_address.private_ip_alloc] } resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { - location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["profile"] %>" - display_name = "<%= ctx[:vars]["profile"] %>_display" - labels = { - testanno = "testanno" - } - alloydb { - cluster_id = "dbmsalloycluster%{random_suffix}" - settings { - initial_user { - user = "alloyuser%{random_suffix}" - password = "alloypass%{random_suffix}" - } - vpc_network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}" - labels = { - testalloylabela = "testalloylabelb" - } - primary_instance_settings { - id = "priminstid" - machine_config { - cpu_count = 2 - } - database_flags = { - } - labels = { - testalloyinstlabela = "testalloyinstlabelb" - } - } - } - } + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["profile"] %>" + display_name = "<%= ctx[:vars]["profile"] %>_display" + labels = { + foo = "bar" + } + alloydb { + cluster_id = "dbmsalloycluster%{random_suffix}" + settings { + initial_user { + user = "alloyuser%{random_suffix}" + password = "alloypass%{random_suffix}" + } + vpc_network = "projects/${data.google_project.project.number}/global/networks/${google_compute_network.default.name}" + labels = { + alloyfoo = "alloybar" + } + primary_instance_settings { + id = "priminstid" + machine_config { + cpu_count = 2 + } + database_flags = { + } + labels = { + alloysinstfoo = "allowinstbar" + } + } + } + } depends_on = [google_service_networking_connection.vpc_connection] } \ No newline at end of file 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 fc5b26735458..784337cbacc0 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] } @@ -23,64 +23,64 @@ resource "google_sql_user" "sqldb_user" { instance = google_sql_database_instance.cloudsqldb.name password = "<%= ctx[:vars]["sqldb_pass"] %>" - depends_on = [google_sql_ssl_cert.sql_client_cert] + depends_on = [google_sql_ssl_cert.sql_client_cert] } resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { - location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["from_profile"] %>" - display_name = "<%= ctx[:vars]["from_profile"] %>_display" - labels = { - testanno = "testanno" - } - mysql { - 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_certificate = google_sql_ssl_cert.sql_client_cert.cert - ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert - } - cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" - } + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["from_profile"] %>" + display_name = "<%= ctx[:vars]["from_profile"] %>_display" + labels = { + estanno = "testanno" + } + mysql { + 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_certificate = google_sql_ssl_cert.sql_client_cert.cert + ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert + } + cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" + } - depends_on = [google_sql_user.sqldb_user] + depends_on = [google_sql_user.sqldb_user] } resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>_destination" { - location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["to_profile"] %>" - display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" - labels = { - testlabela = "testlabelb" - } - cloudsql { - settings { - database_version = "MYSQL_5_7" - user_labels = { - testuserlabela = "testuserlabelb" - } - 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" - } + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["to_profile"] %>" + display_name = "<%= ctx[:vars]["to_profile"] %>_displayname" + labels = { + testlabela = "testlabelb" + } + cloudsql { + settings { + database_version = "MYSQL_5_7" + user_labels = { + testuserlabela = "testuserlabelb" + } + 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" + } - } - depends_on = [google_database_migration_service_connection_profile.<%= ctx[:primary_resource_id] %>] + } + depends_on = [google_database_migration_service_connection_profile.<%= ctx[:primary_resource_id] %>] } diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb index 8515a6911417..ce6150a121f1 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb @@ -11,7 +11,7 @@ resource "google_sql_ssl_cert" "sql_client_cert" { common_name = "<%= ctx[:vars]["sqldb_cert"] %>" instance = google_sql_database_instance.postgresqldb.name - depends_on = [google_sql_database_instance.postgresqldb] + depends_on = [google_sql_database_instance.postgresqldb] } resource "google_sql_user" "sqldb_user" { @@ -20,28 +20,27 @@ resource "google_sql_user" "sqldb_user" { password = "<%= ctx[:vars]["sqldb_pass"] %>" - depends_on = [google_sql_ssl_cert.sql_client_cert] + depends_on = [google_sql_ssl_cert.sql_client_cert] } resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { - location = "us-central1" - connection_profile_id = "<%= ctx[:vars]["profile"] %>" - display_name = "<%= ctx[:vars]["profile"] %>_display" - labels = { - testanno = "testanno" - } - postgresql { - host = google_sql_database_instance.postgresqldb.ip_address.0.ip_address - port = 5432 - 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_certificate = google_sql_ssl_cert.sql_client_cert.cert - ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert - } - cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" - - } - depends_on = [google_sql_user.sqldb_user] + location = "us-central1" + connection_profile_id = "<%= ctx[:vars]["profile"] %>" + display_name = "<%= ctx[:vars]["profile"] %>_display" + labels = { + foo = "bar" + } + postgresql { + host = google_sql_database_instance.postgresqldb.ip_address.0.ip_address + port = 5432 + 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_certificate = google_sql_ssl_cert.sql_client_cert.cert + ca_certificate = google_sql_ssl_cert.sql_client_cert.server_ca_cert + } + cloud_sql_id = "<%= ctx[:vars]["sqldb"] %>" + } + depends_on = [google_sql_user.sqldb_user] } diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index dc0b8d5129ae..2aa00a8be5a7 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -46,7 +46,7 @@ resource "google_database_migration_service_connection_profile" "default" { connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" display_name = "tf-test-dbms-connection-profile-display%{random_suffix}" labels = { - testanno = "testanno" + foo = "bar" } mysql { host = "10.20.30.40" @@ -63,9 +63,9 @@ func testAccDatabaseMigrationServiceConnectionProfile_update(context map[string] resource "google_database_migration_service_connection_profile" "default" { location = "us-central1" connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" - display_name = "tf-test-dbms-connection-profile-display%{random_suffix}" + display_name = "tf-test-dbms-connection-profile-updated-display%{random_suffix}" labels = { - testanno = "testanno" + bar = "foo" } mysql { host = "10.20.30.50" From 483f28361606479268a9384b3df5dd6e3b5fc477 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Thu, 20 Apr 2023 11:34:44 -0700 Subject: [PATCH 20/22] test indentation --- ..._database_migration_service_connection_profile_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index 2aa00a8be5a7..a99c1bcbe5ef 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -46,8 +46,8 @@ resource "google_database_migration_service_connection_profile" "default" { connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" display_name = "tf-test-dbms-connection-profile-display%{random_suffix}" labels = { - foo = "bar" - } + foo = "bar" + } mysql { host = "10.20.30.40" port = 3306 @@ -65,8 +65,8 @@ resource "google_database_migration_service_connection_profile" "default" { connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" display_name = "tf-test-dbms-connection-profile-updated-display%{random_suffix}" labels = { - bar = "foo" - } + bar = "foo" + } mysql { host = "10.20.30.50" port = 3306 From 05baa6b8012945b7d49fb8f02e629fdf43f6c273 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Thu, 20 Apr 2023 11:40:08 -0700 Subject: [PATCH 21/22] removing trailing white space --- ...migration_service_connection_profile_alloydb.tf.erb | 2 +- ...igration_service_connection_profile_cloudsql.tf.erb | 10 +++++----- ...migration_service_connection_profile_postgre.tf.erb | 2 +- ...tabase_migration_service_connection_profile_test.go | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb index e425ab1d86a7..2e6ecd0c7774 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_alloydb.tf.erb @@ -25,7 +25,7 @@ resource "google_service_networking_connection" "vpc_connection" { resource "google_database_migration_service_connection_profile" "<%= ctx[:primary_resource_id] %>" { - location = "us-central1" + location = "us-central1" connection_profile_id = "<%= ctx[:vars]["profile"] %>" display_name = "<%= ctx[:vars]["profile"] %>_display" labels = { 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 784337cbacc0..d06ac4b57527 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 @@ -29,11 +29,11 @@ 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" labels = { - estanno = "testanno" + foo = "bar" } mysql { host = google_sql_database_instance.cloudsqldb.ip_address.0.ip_address @@ -53,17 +53,17 @@ 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" labels = { - testlabela = "testlabelb" + foo = "bar" } cloudsql { settings { database_version = "MYSQL_5_7" user_labels = { - testuserlabela = "testuserlabelb" + cloudfoo = "cloudbar" } tier = "db-n1-standard-1" storage_auto_resize_limit = "0" diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb index ce6150a121f1..632640f4175d 100644 --- a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb +++ b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb @@ -24,7 +24,7 @@ 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]["profile"] %>" display_name = "<%= ctx[:vars]["profile"] %>_display" labels = { diff --git a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go index a99c1bcbe5ef..4cbb6ac3ad97 100644 --- a/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go +++ b/mmv1/third_party/terraform/tests/resource_database_migration_service_connection_profile_test.go @@ -42,7 +42,7 @@ func TestAccDatabaseMigrationServiceConnectionProfile_update(t *testing.T) { func testAccDatabaseMigrationServiceConnectionProfile_basic(context map[string]interface{}) string { return Nprintf(` resource "google_database_migration_service_connection_profile" "default" { - location = "us-central1" + location = "us-central1" connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" display_name = "tf-test-dbms-connection-profile-display%{random_suffix}" labels = { @@ -61,7 +61,7 @@ resource "google_database_migration_service_connection_profile" "default" { func testAccDatabaseMigrationServiceConnectionProfile_update(context map[string]interface{}) string { return Nprintf(` resource "google_database_migration_service_connection_profile" "default" { - location = "us-central1" + location = "us-central1" connection_profile_id = "tf-test-dbms-connection-profile%{random_suffix}" display_name = "tf-test-dbms-connection-profile-updated-display%{random_suffix}" labels = { From 5665a8a8e98dbf24311506a297c03235209fcde4 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Thu, 20 Apr 2023 12:33:21 -0700 Subject: [PATCH 22/22] renamed file --- ...database_migration_service_connection_profile_postgres.tf.erb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename mmv1/templates/terraform/examples/{database_migration_service_connection_profile_postgre.tf.erb => database_migration_service_connection_profile_postgres.tf.erb} (100%) diff --git a/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb b/mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgres.tf.erb similarity index 100% rename from mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgre.tf.erb rename to mmv1/templates/terraform/examples/database_migration_service_connection_profile_postgres.tf.erb