Private network creation with Terraform on OVH's Openstack

假装没事ソ 提交于 2019-12-06 00:48:11

After a few days, everything worked. Despite what the provider's support is saying, it appears to be a bug : I didn't change anything and it worker suddenly out of nowhere.

EDIT: After a few weeks, I ended up with the following code :

Careful with copy/pasting, my compute_instance is in a module, thus all those var

resource "ovh_publiccloud_private_network" "network" {
  provider   = "ovh.ovh"
  project_id = "${var.tenant_id}"
  name       = "Private Network"
  regions    = "${values(var.regions)}"
}

resource "ovh_publiccloud_private_network_subnet" "subnet" {
  provider   = "ovh.ovh"
  project_id = "${var.tenant_id}"
  network_id = "${element(ovh_publiccloud_private_network.network.*.id, count.index)}"

  start   = FIRST_PRIVATE_IP
  end     = LAST_PRIVATE_IP
  network = PRIVATE_SUBNET

  count      = "${length(var.regions)}"
  region     = "${element(values(var.regions), count.index)}"
}

resource "openstack_compute_instance_v2" "compute_instance" {
  provider            = "openstack.ovh"
  region              = "${var.region_id}"
  key_pair            = "${var.keypair}"
  flavor_name         = "${var.instance_flavor}"
  image_name          = "${var.instance_image}"

  network = [
    {
      name = "Ext-Net"
    },
    {
      name        = "${var.private_network}"
      fixed_ip_v4 = MY_PRIVATE_IP
    },
  ]
}

I'm not using port anymore. The choice to stop using port isn't related to that issue.

Since Debian 9, the instance might try to configure the private interface as the interface to reach the Internet. Which won't work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!