如何将附加接口附加到实例,在Openstack中使用Terraform创建帖子

时间:2018-02-15 10:40:58

标签: openstack terraform openstack-nova openstack-neutron terraform-provider-openstack

我使用的是Openstack Kilo和Terraform V 0.10 我需要将同一网络的多个接口连接到一个实例。 我尝试过以下尝试:

使用相同的网络在openstack_compute_instance_v2中添加网络块三次:

resource "openstack_compute_instance_v2" "VM`1" {
  name        = "VM1"
  count       = "1"
  image_name  = "image"
  flavor_name = "flavor"

  network = {
    uuid = "${openstack_networking_network_v2.NET_1.id}"
  }

  network = {
    uuid = "${openstack_networking_network_v2.NET_1.id}"
  }

  network = {
    uuid = "${openstack_networking_network_v2.NET_1.id}"
  }
}

创建了三个相同网络的端口,并尝试将它们添加到compute_instance中:

resource "openstack_compute_instance_v2" "VM1" {
  name        = "VM1"
  count       = "1"
  image_name  = "image"
  flavor_name = "flavor"

  network = {
    port = "${openstack_networking_port_v2.port_1.id}"
  }

  network = {
    port = "${openstack_networking_port_v2.port_2.id}"
  }

  network = {
    port = "${openstack_networking_port_v2.port_3.id}"
  }
}

不幸的是两个都行不通。 我能够用单个端口启动实例。 创建后我想添加其他接口。

从字面上看,我想通过单一界面创建以下的虚拟机创建:

nova interface-attach --net-id $NET_1 "$VM1"
nova interface-attach --net-id $NET_1 "$VM1"

0 个答案:

没有答案