我使用以下Terraform配置尝试在Google Cloud Platform上创建子网和Cloud SQL MySQL 5.6实例。
resource "google_compute_network" "default" {
name = "my-default-network"
auto_create_subnetworks = "true"
project = "${google_project.project.project_id}"
}
resource "google_sql_database_instance" "wordpress" {
region = "${var.region}"
database_version = "MYSQL_5_6"
project = "${google_project.project.project_id}"
settings {
tier = "db-n1-standard-1"
ip_configuration {
private_network = "${google_compute_network.default.self_link}"
}
}
}
但是应用此计划会给我带来以下模糊的错误。我还尝试破坏了整个项目,然后再次尝试构建它,但是我遇到了同样的错误。
google_sql_database_instance.wordpress: Still creating... (20s elapsed)
google_sql_database_instance.wordpress: Still creating... (30s elapsed)
google_sql_database_instance.wordpress: Still creating... (40s elapsed)
Error: Error applying plan:
1 error(s) occurred:
* google_sql_database_instance.wordpress: 1 error(s) occurred:
* google_sql_database_instance.wordpress: Error waiting for Create Instance:
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
有人可以在这里看到我的错吗?
编辑:
将TF_LOG=debug
添加到terraform apply
运行时,出现以下错误。
"error": {
"kind": "sql#operationErrors",
"errors": [{
"kind": "sql#operationError",
"code": "INTERNAL_ERROR"
}]
}
编辑2:简化了网络设置,但出现了完全相同的错误。
答案 0 :(得分:1)
参加聚会有点晚,但是我刚刚克服了这个问题。就我而言,这与使用private_networking
选项有关。我的建议是阅读documentation,注意“网络要求”并检查以下内容:
servicenetworking.googleapis.com
API 我发现在临时实例中验证私有网络是一个问题(通过删除私有网络并设置ipv4_enabled = "true"
)有助于集中精力进行调试。
祝你好运!