我正在尝试通过Terraform将GCS上的所有主VM实例添加到Google计算实例组中。
这是我使用的代码片段。
resource "google_compute_instance_group" "masters" {
name = "master-api"
description = "Master API group"
count = "${var.mastercount}"
instances = ["${google_compute_instance.master.*.self_link}"]
named_port {
name = "api"
port = "6443"
}
zone = "${"${var.region}-b"}"
}
当我应用计划时,我确实得到了我的“master-api”组,但我也得到错误输出。 在我看来,它试图创造更多的一个群体。
Error: Error applying plan:
2 error(s) occurred:
* google_compute_instance_group.masters[2]: 1 error(s) occurred:
* google_compute_instance_group.masters.2: Error creating InstanceGroup: googleapi: Error 409: The resource 'projects/appportablityphase2/zones/us-east1-b/instanceGroups/master-api' already exists, alreadyExists
* google_compute_instance_group.masters[0]: 1 error(s) occurred:
* google_compute_instance_group.masters.0: Error creating InstanceGroup: googleapi: Error 409: The resource 'projects/appportablityphase2/zones/us-east1-b/instanceGroups/master-api' already exists, alreadyExists