我正在尝试使用Terraform创建一个OpenStack实例,但出现以下错误:

Error applying plan:

1 error(s) occurred:

* openstack_compute_instance_v2.basic: Error creating OpenStack server: Invalid
request due to incorrect syntax or missing required parameters.

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with

但是相同的Terraform代码确实可以在我的OpenStack帐户中成功创建安全组, key 对和卷

这是我的Terraform代码:
provider "openstack" {
  user_name = "admin"
  tenant_name = "admin"
  password  = "admin"
  auth_url  = "http://my_IP():5000/v2.0"
}
resource "openstack_blockstorage_volume_v1" "myvol" {
  name = "myvol"
  size = 1
}
resource "openstack_compute_instance_v2" "basic" {
  name = "basic"
  image_id = "8ce1c922-ad0-81a3-823ea1b0af9b"
  flavor_id = "2"
  key_pair = "tf-keypair-1"
  security_groups = ["default"]

  metadata {
    this = "that"
  }

  network {
    name = "8b510300-610a--9cc3-6e76e33395b4"
  }
  volume {
    volume_id = "${openstack_blockstorage_volume_v1.myvol.id}"
  }
}

最佳答案

直到最近,很难调试此消息。在version 0.8.8 of Terraform(更具体地说是Enable HTTP Logging improvement for the OpenStack Terraform provider))中,团队添加了OS_DEBUG环境变量以帮助在此类情况下提供更多信息。一种使用方式如下:

TF_LOG=DEBUG OS_DEBUG=1 terraform apply ...

一旦收到此消息,是因为我忘记为正在使用的用户在OpenStack中添加ssh key 。

关于openstack - 无法从Terraform启动Openstack实例,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40651778/

10-11 06:35