Terraform:尚未创建google_sql_database_instance

时间:2019-11-23 05:35:07

标签: google-cloud-platform terraform google-cloud-sql

我正在尝试使用terraform创建一个CloudSQL实例,但它甚至没有尝试创建它出现:CloudSQL仪表板没有更改

enter image description here

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]

它最终超时。这是为什么?

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
    # }
  }
}

我什至删除了专用网络部分

1 个答案:

答案 0 :(得分:2)

好,所以我设置TF_LOG = DEBUG并看到

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

经过一番谷歌搜索,我发现https://github.com/hashicorp/terraform/issues/20972

  

之所以会发生这种情况,是因为实例名称在删除后最多不能再使用一周。

所以我想问题是因为我正在尝试创建一个使用最近使用过的名称的实例...