2

How am I supposed to create a private network/subnet on OVH using Terraform? There is a common resource related to OpenStack (openstack_networking_subnet_v2) and ovh-specific (ovh_publiccloud_private_network_subnet) if you use ovh provider.

I am asking because when I follow this guide, my private network interface does not get ipv4-address assigned on interface (looks like the same problem was already described in this question: Private network creation with Terraform on OVH's Openstack). I can see an ip-addr in Horizon control-panel, but when i ssh to instance using Ext-net ipv4 addr and type ifconfig I see there is no ipv4 addr assigned for private network interface. Interface is UP but no ipv4 assigned. I just use Terraform code from guide like this:

# Create a private sub network
resource "ovh_publiccloud_private_network_subnet" "private_subnet" {
  # Get the id of the resource ovh_publiccloud_private_network named
  # private_network
  network_id = "${ovh_publiccloud_private_network.private_network.id}"
  project_id = "${var.project_id}" # With OS_TENANT_ID your tenant id's project
  region = "WAW1" # With OS_REGION_NAME the OS_REGION_NAME environment variable
  network = "192.168.42.0/24" # Global network
  start = "192.168.42.2" # First IP for the subnet
  end = "192.168.42.200" # Last IP for the subnet
  dhcp = false # Deactivate the DHCP service
  provider = "ovh.ovh" # Provider's name
}

resource "openstack_compute_instance_v2" "front" {
  # Number of time the instance will be created
  count = "${length(var.front_private_ip)}"
  provider = "openstack.ovh" # Provider's name
  name = "front" # Instance's name
  flavor_name = "s1-2" # Flavor's name
  image_name = "CoreOS Stable" # Image's name
  key_pair = "${openstack_compute_keypair_v2.test_keypair.name}"
  security_groups = ["default"] # Add into a security group
  network = [
    {
      name = "Ext-Net" # Public interface name
    }
  ,
    {
      # Private interface name
      name = "${ovh_publiccloud_private_network.private_network.name}"
      # Give an IP address depending on count.index
      fixed_ip_v4 = "192.168.42.4"
    }
  ]
}

So as I said the above example does not work for me (because I have to manually assign private ipv4-addr on interface while I would like Terraform to do it for me). Then I discovered terraform-ovh-publiccloud-network module on OVH github. Tried simple example from this repo (copy-pasted from ReadMe) and I can see that second interface on Bastion node gets Ipv4 addr assigned from private net range successfully. From module's code I can also see that openstack_networking_subnet_v2 resource is used instead of OVH-specific ovh_publiccloud_private_network_subnet? Why and what is the difference between them? Which one am I supposed to use when I write my own Terraform definition from scratch?

My goal is just to create a private network/subnet and create a compute instance with two interfaces (connected to public Ext-Net and private subnet I just created). Please provide me a short working example for OVH if you have such experience or let me know if I am missing something.

Kirill
  • 6,762
  • 4
  • 51
  • 81

1 Answers1

0

You can rent a /24 of public IPs from OVH for like $800. But you gotta do that first.

Luke Mlsna
  • 468
  • 4
  • 16