cloud sqlでエラーが出ます。
Q&A
Closed
解決したいこと
cloud sqlでレプリケーションをしたい。
main.tf
resource "google_sql_database_instance" "master" {
name = "app1-db-1"
database_version = "MYSQL_8_0"
region = "asia-northeast1"
project = "<project-id>"
settings {
tier = "db-f1-micro"
}
}
resource "google_sql_database" "database" {
name = "users-db"
instance = "app1-db-1"
project = "<project-id>"
charset = "utf8mb4"
collation = "utf8mb4_bin"
}
resource "google_sql_user" "users" {
name = "root"
instance = "app1-db-1"
project = "<project-id>"
host = "%"
password = "Curry000"
}
resource "google_sql_database_instance" "read_replica" {
name = "app1-db"
master_instance_name = "app1-db-1"
region = "asia-northeast2"
database_version = "MYSQL_8_0"
project = "<project-id>"
settings {
tier = "db-f1-micro"
availability_type = "REGIONAL"
ip_configuration {
ipv4_enabled = true
}
}
}
エラーメッセージ
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to google_sql_user.users, provider "provider[\"registry.terraform.io/hashicorp/google\"]" produced an unexpected new value: Root object was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Error creating Database: googleapi: Error 403: The client is not authorized to make this request., notAuthorized
│
│ with google_sql_database.database,
│ on main.tf line 18, in resource "google_sql_database" "database":
│ 18: resource "google_sql_database" "database" {
│
╵
╷
│ Error: Error, failed to create instance app1-db: googleapi: Error 400: The requested operation is not allowed with an instance that does not have binary log enabled., errorBinLogNotEnabled
│
│ with google_sql_database_instance.read_replica,
│ on main.tf line 34, in resource "google_sql_database_instance" "read_replica":
│ 34: resource "google_sql_database_instance" "read_replica" {
自分で試したこと
マスターまでは作成できるが"read_replica"が作成されない。
プロジェクトIDやregionをすべてmainに書いた。
0