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.
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 version running on your source database server.
Possible values are: MYSQL_5_6
, MYSQL_5_7
, MYSQL_8_0
, POSTGRES_9_6
, POSTGRES_10
, POSTGRES_11
, POSTGRES_12
, POSTGRES_13
, POSTGRES_14
.
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 format projects/{{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.