blob: 17c12edefb6d818a7f2b6dc9996120158dc47a9e [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Cloud SQL"
description: |-
A source representation instance is a Cloud SQL instance that represents
the source database server to the Cloud SQL replica.
---
# google\_sql\_source\_representation\_instance
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: `on_premises_configuration.password`.
[Read more about sensitive data in state](https://www.terraform.io/language/state/sensitive-data).
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=sql_source_representation_instance_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Sql Source Representation Instance Basic
```hcl
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"
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=sql_source_representation_instance_postgres&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Sql Source Representation Instance Postgres
```hcl
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"
}
```
## Argument Reference
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.
## Attributes Reference
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}}`
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
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](https://developer.hashicorp.com/terraform/language/import) to import SourceRepresentationInstance using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/instances/{{name}}"
to = google_sql_source_representation_instance.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).