diff --git a/builtin/providers/openstack/devstack/deploy.sh b/builtin/providers/openstack/devstack/deploy.sh index 6c85a4795..8e19bc1ae 100644 --- a/builtin/providers/openstack/devstack/deploy.sh +++ b/builtin/providers/openstack/devstack/deploy.sh @@ -116,10 +116,12 @@ wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img glance image-create --name CirrOS --disk-format qcow2 --container-format bare < cirros-0.3.4-x86_64-disk.img nova flavor-create m1.tform 99 512 5 1 --ephemeral 10 _NETWORK_ID=$(nova net-list | grep private | awk -F\| '{print $2}' | tr -d ' ') +_EXTGW_ID=$(nova net-list | grep public | awk -F\| '{print $2}' | tr -d ' ') _IMAGE_ID=$(nova image-list | grep CirrOS | awk -F\| '{print $2}' | tr -d ' ' | head -1) echo export OS_IMAGE_NAME="cirros-0.3.4-x86_64-uec" >> openrc echo export OS_IMAGE_ID="$_IMAGE_ID" >> openrc echo export OS_NETWORK_ID=$_NETWORK_ID >> openrc +echo export OS_EXTGW_ID=$_EXTGW_ID >> openrc echo export OS_POOL_NAME="public" >> openrc echo export OS_FLAVOR_ID=99 >> openrc source openrc demo diff --git a/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go b/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go index 015e64320..179596202 100644 --- a/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go +++ b/builtin/providers/openstack/resource_openstack_networking_floatingip_v2_test.go @@ -69,45 +69,45 @@ func TestAccNetworkingV2FloatingIP_fixedip_bind(t *testing.T) { var fip floatingips.FloatingIP var testAccNetworkingV2FloatingIP_fixedip_bind = fmt.Sprintf(` resource "openstack_networking_network_v2" "network_1" { - name = "network_1" - admin_state_up = "true" - } + 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" - ip_version = 4 - } + 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" + ip_version = 4 + } - resource "openstack_networking_router_interface_v2" "router_interface_1" { - router_id = "${openstack_networking_router_v2.router_1.id}" - subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}" - } + resource "openstack_networking_router_interface_v2" "router_interface_1" { + router_id = "${openstack_networking_router_v2.router_1.id}" + subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}" + } - resource "openstack_networking_router_v2" "router_1" { - name = "router_1" - external_gateway = "%s" - } + resource "openstack_networking_router_v2" "router_1" { + name = "router_1" + external_gateway = "%s" + } - resource "openstack_networking_port_v2" "port_1" { - network_id = "${openstack_networking_subnet_v2.subnet_1.network_id}" - admin_state_up = "true" - fixed_ip { - subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}" - ip_address = "192.168.199.10" - } - fixed_ip { - subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}" - ip_address = "192.168.199.20" - } - } + resource "openstack_networking_port_v2" "port_1" { + network_id = "${openstack_networking_subnet_v2.subnet_1.network_id}" + admin_state_up = "true" + fixed_ip { + subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}" + ip_address = "192.168.199.10" + } + fixed_ip { + subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}" + ip_address = "192.168.199.20" + } + } - resource "openstack_networking_floatingip_v2" "ip_1" { - pool = "%s" - port_id = "${openstack_networking_port_v2.port_1.id}" - fixed_ip = "${openstack_networking_port_v2.port_1.fixed_ip.1.ip_address}" - }`, + resource "openstack_networking_floatingip_v2" "ip_1" { + pool = "%s" + port_id = "${openstack_networking_port_v2.port_1.id}" + fixed_ip = "${openstack_networking_port_v2.port_1.fixed_ip.1.ip_address}" + }`, os.Getenv("OS_EXTGW_ID"), os.Getenv("OS_POOL_NAME")) resource.Test(t, resource.TestCase{