I want to create a Cloud SQL instance in a project, connected to a host VPC. However, when running terraform apply
I get the same result every time:
google_sql_database_instance.default: Still creating... [1m20s elapsed]
google_sql_database_instance.default: Still creating... [1m30s elapsed]
google_sql_database_instance.default: Still creating... [1m40s elapsed]
google_sql_database_instance.default: Still creating... [1m50s elapsed]
Error: Error waiting for Create Instance:
Error: Process completed with exit code 1.
I saw other answers here that claim that the problem goes away by configuring private service access, however this does not seem to fix my problem.
Here is my terraform file, with the relevant sections:
google_compute_global_address" "private_ip_address" {
provider = google-beta
project = data.google_compute_subnetwork.subnet.project
name = "private-ip-address"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = data.google_compute_network.shared-vpc.id
}
resource "google_service_networking_connection" "private_vpc_connection" {
provider = google-beta
network = data.google_compute_network.shared-vpc.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_address.name]
}
resource "google_sql_database_instance" "default" {
provider = google-beta
project = module.base_shared_vpc_project.project_id
name = var.db_name
database_version = "MYSQL_5_7"
region = "us-east1"
settings {
tier = "db-f1-micro"
availability_type = "ZONAL"
location_preference {
zone = "us-east1-b"
}
ip_configuration {
ipv4_enabled = false
private_network = data.google_compute_network.shared-vpc.id
}
}
depends_on = [google_service_networking_connection.private_vpc_connection]
}
One final bit of information, setting TF_LOG=DEBUG
provides only this additional message: Retry Transport: Stopping retries, last request failed with non-retryable error