openstack_networking_port_v2

Manages a V2 port resource within OpenStack.

Example Usage

Simple port

resource "openstack_networking_network_v2" "network_1" {
  name           = "network_1"
  admin_state_up = "true"
}

resource "openstack_networking_port_v2" "port_1" {
  name           = "port_1"
  network_id     = openstack_networking_network_v2.network_1.id
  admin_state_up = "true"
}

Port defining fixed_ip.subnet_id

resource "openstack_networking_network_v2" "network_1" {
  name           = "network_1"
  admin_state_up = "true"
}

resource "openstack_networking_subnet_v2" "subnet_1" {
  name       = "subnet_1"
  network_id = openstack_networking_network_v2.network_1.id
  cidr       = "192.168.199.0/24"
}

resource "openstack_networking_port_v2" "port_1" {
  name           = "port_1"
  network_id     = openstack_networking_network_v2.network_1.id
  admin_state_up = "true"

  fixed_ip {
    subnet_id = openstack_networking_subnet_v2.subnet_1.id
  }
}

Port with physical binding information

resource "openstack_networking_network_v2" "network_1" {
  name           = "network_1"
  admin_state_up = "true"
}

resource "openstack_networking_port_v2" "port_1" {
  name           = "port_1"
  network_id     = openstack_networking_network_v2.network_1.id
  device_id      = "cdf70fcf-c161-4f24-9c70-96b3f5a54b71"
  device_owner   = "baremetal:none"
  admin_state_up = "true"

  binding {
    host_id   = "b080b9cf-46e0-4ce8-ad47-0fd4accc872b"
    vnic_type = "baremetal"
    profile   = <<EOF
{
  "local_link_information": [
    {
      "switch_info": "info1",
      "port_id": "Ethernet3/4",
      "switch_id": "12:34:56:78:9A:BC"
    },
    {
      "switch_info": "info2",
      "port_id": "Ethernet3/4",
      "switch_id": "12:34:56:78:9A:BD"
    }
  ],
  "vlan_type": "allowed"
}
EOF
  }
}

Argument Reference

The following arguments are supported:

The fixed_ip block supports:

The allowed_address_pairs block supports:

The extra_dhcp_option block supports:

The binding block supports:

Attributes Reference

The following attributes are exported:

Import

Ports can be imported using the id, e.g.

$ terraform import openstack_networking_port_v2.port_1 eae26a3e-1c33-4cc1-9c31-0cd729c438a1

Notes

Ports and Instances

There are some notes to consider when connecting Instances to networks using Ports. Please see the openstack_compute_instance_v2 documentation for further documentation.