Reputation: 88197
I am trying to create a CloudSQL instance using terraform but its not even trying to create it appears: The CloudSQL dashboard doesnt change
google_sql_database_instance.db-instance: Still creating... [9m41s elapsed]
google_sql_database_instance.db-instance: Still creating... [9m51s elapsed]
google_sql_database_instance.db-instance: Still creating... [10m1s elapsed]
It eventually timesout. Why is that?
resource "google_sql_database_instance" "db-instance" {
# depends_on = [google_service_networking_connection.private-vpc-connection]
name = "sonarqube"
database_version = "POSTGRES_9_6"
region = "asia-southeast1"
settings {
tier = "db-f1-micro"
# ip_configuration {
# private_network = google_compute_network.private-network.self_link
# }
}
}
I even removed the private networking parts
Upvotes: 4
Views: 2188
Reputation: 88197
Ok, so I set TF_LOG=DEBUG and saw
2019-11-23T22:04:41.365+0800 [DEBUG] plugin.terraform-provider-google-beta_v3.0.0-beta.1_x4: 2019/11/23 22:04:41 [DEBUG] Dismissed an error as retryable. Waiting for other concurrent Cloud SQL operations to finish - googleapi: Error 409: The instance or operation is not in an appropriate state to handle the request., invalidState
After some googling, I found https://github.com/hashicorp/terraform/issues/20972
This happens because instance names cannot be reused for up to a week after it's deleted.
So I guess the issue is because I am attempting to create an instance with a name that was recently used ...
Upvotes: 12