| subcategory | description |
|---|---|
Cloud SQL |
A source representation instance is a Cloud SQL instance that represents
the source database server to the Cloud SQL replica. |
A source representation instance is a Cloud SQL instance that represents the source database server to the Cloud SQL replica. It is visible in the Cloud Console and appears the same as a regular Cloud SQL instance, but it contains no data, requires no configuration or maintenance, and does not affect billing. You cannot update the source representation instance.
~> Warning: All arguments including the following potentially sensitive
values will be stored in the raw state as plain text: password.
Read more about sensitive data in state.
resource "google_sql_source_representation_instance" "instance" {
name = "my-instance"
region = "us-central1"
database_version = "MYSQL_8_0"
host = "10.20.30.40"
port = 3306
username = "some-user"
password = "password-for-the-user"
dump_file_path = "gs://replica-bucket/source-database.sql.gz"
}resource "google_sql_source_representation_instance" "instance" {
name = "my-instance"
region = "us-central1"
database_version = "POSTGRES_9_6"
host = "10.20.30.40"
port = 3306
username = "some-user"
password = "password-for-the-user"
dump_file_path = "gs://replica-bucket/source-database.sql.gz"
}The following arguments are supported:
-
name- (Required) The name of the source representation instance. Use any valid Cloud SQL instance name. -
database_version- (Required) The MySQL, PostgreSQL or SQL Server (beta) version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, MYSQL_8_4, POSTGRES_9_6, POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, POSTGRES_15, POSTGRES_16, POSTGRES_17, POSTGRES_18. Database Version Policies includes an up-to-date reference of supported versions. -
host- (Required) The IPv4 address and port for the external server, or the the DNS address for the external server. If the external server is hosted on Cloud SQL, the port is 5432. -
region- (Optional) The Region in which the created instance should reside. If it is not provided, the provider region is used. -
port- (Optional) The externally accessible port for the source database server. Defaults to 3306. -
username- (Optional) The replication user account on the external server. -
password- (Optional) The password for the replication user account. Note: This property is sensitive and will not be displayed in the plan. -
dump_file_path- (Optional) A file in the bucket that contains the data from the external server. -
ca_certificate- (Optional) The CA certificate on the external server. Include only if SSL/TLS is used on the external server. -
client_certificate- (Optional) The client certificate on the external server. Required only for server-client authentication. Include only if SSL/TLS is used on the external server. -
client_key- (Optional) The private key file for the client certificate on the external server. Required only for server-client authentication. Include only if SSL/TLS is used on the external server. -
project- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
In addition to the arguments listed above, the following computed attributes are exported:
id- an identifier for the resource with formatprojects/{{project}}/instances/{{name}}
This resource provides the following Timeouts configuration options:
create- Default is 20 minutes.delete- Default is 20 minutes.
SourceRepresentationInstance can be imported using any of these accepted formats:
projects/{{project}}/instances/{{name}}{{project}}/{{name}}{{name}}
In Terraform v1.5.0 and later, use an import block to import SourceRepresentationInstance using one of the formats above. For example:
import {
id = "projects/{{project}}/instances/{{name}}"
to = google_sql_source_representation_instance.default
}When using the terraform import command, SourceRepresentationInstance can be imported using one of the formats above. For example:
$ terraform import google_sql_source_representation_instance.default projects/{{project}}/instances/{{name}}
$ terraform import google_sql_source_representation_instance.default {{project}}/{{name}}
$ terraform import google_sql_source_representation_instance.default {{name}}This resource supports User Project Overrides.