Clona un'istanza Cloud SQL per Postgres Enterprise Plus

Questo Terraform mostra come creare un clone di un'istanza Postgres

Esempio di codice

Terraform

Per scoprire come applicare o rimuovere una configurazione Terraform, consulta Comandi Terraform di base. Per saperne di più, consulta la documentazione di riferimento del fornitore Terraform.

resource "google_sql_database_instance" "source" {
  name             = "postgres-enterprise-plus-instance-source-name"
  region           = "us-central1"
  database_version = "POSTGRES_15"
  settings {
    tier    = "db-perf-optimized-N-2"
    edition = "ENTERPRISE_PLUS"
  }
  # set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
  # use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
  deletion_protection = false
}

resource "google_sql_database_instance" "clone" {
  name             = "postgres-enterprise-plus-instance-clone-name"
  region           = "us-central1"
  database_version = "POSTGRES_15"
  settings {
    tier    = "db-perf-optimized-N-2"
    edition = "ENTERPRISE_PLUS"
  }
  clone {
    source_instance_name = google_sql_database_instance.source.id
  }
  # set `deletion_protection` to true, will ensure that one cannot accidentally delete this instance by
  # use of Terraform whereas `deletion_protection_enabled` flag protects this instance at the GCP level.
  deletion_protection = false
}

Passaggi successivi

Per cercare e filtrare gli esempi di codice per altri prodotti Google Cloud , consulta il browser degli esempi diGoogle Cloud .