Skip to content

Instantly share code, notes, and snippets.

@styk-tv
Created September 7, 2019 00:45
Show Gist options
  • Save styk-tv/8580721050dfc66eac3275d51eaab41e to your computer and use it in GitHub Desktop.
Save styk-tv/8580721050dfc66eac3275d51eaab41e to your computer and use it in GitHub Desktop.
openstack create port for instance
resource "openstack_networking_network_v2" "network_1" {
name = "network_1"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
name = "subnet_1"
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.1.0/24"
ip_version = 4
enable_dhcp = true
}
resource "openstack_networking_port_v2" "port_1" {
/*
depends_on = [
"openstack_networking_subnet_v2.subnet_1",
]
*/
name = "port_1"
network_id = "${openstack_networking_network_v2.network_1.id}"
admin_state_up = "true"
}
resource "openstack_compute_instance_v2" "instance_1" {
name = "instance_1"
network {
port = "${openstack_networking_port_v2.port_1.id}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment