cloudsqlでレプリケーションをつくってみました。
下記コード
main.tf
resource "google_sql_database_instance" "primary" {
name = "mysql-primary-instance-name"
region = "asia-northeast1"
database_version = "MYSQL_8_0"
settings {
tier = "db-f1-micro"
backup_configuration {
enabled = "true"
binary_log_enabled = "true"
}
}
deletion_protection = false
}
resource "google_sql_database_instance" "read_replica" {
name = "mysql-replica-instance-name"
master_instance_name = google_sql_database_instance.primary.name
region = "asia-northeast1"
database_version = "MYSQL_8_0"
replica_configuration {
failover_target = false
}
settings {
tier = "db-f1-micro"
availability_type = "ZONAL"
disk_size = "10"
}
# 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
}
Terraformでユーザーを追加しようとするとエラーがでます。
ユーザーはGUIで登録するしかないです。