Skip to content

Commit

Permalink
provider/openstack: More Import and Region Fixes
Browse files Browse the repository at this point in the history
This has a few more import and region fixes from hashicorp#10509
  • Loading branch information
jtopjian committed Dec 11, 2016
1 parent e6b1cda commit f07dcd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package openstack

import (
"fmt"
"os"
"testing"

"github.com/hashicorp/terraform/helper/resource"
Expand Down Expand Up @@ -41,37 +40,31 @@ func TestAccNetworkingV2Network_basic(t *testing.T) {
}

func TestAccNetworkingV2Network_netstack(t *testing.T) {
region := os.Getenv(OS_REGION_NAME)

var network networks.Network
var subnet subnets.Subnet
var router routers.Router

var testAccNetworkingV2Network_netstack = fmt.Sprintf(`
resource "openstack_networking_network_v2" "foo" {
region = "%s"
name = "network_1"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "foo" {
region = "%s"
name = "subnet_1"
network_id = "${openstack_networking_network_v2.foo.id}"
cidr = "192.168.10.0/24"
ip_version = 4
}
resource "openstack_networking_router_v2" "foo" {
region = "%s"
name = "router_1"
}
resource "openstack_networking_router_interface_v2" "foo" {
region = "%s"
router_id = "${openstack_networking_router_v2.foo.id}"
subnet_id = "${openstack_networking_subnet_v2.foo.id}"
}`, region, region, region, region)
}`)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -92,8 +85,6 @@ func TestAccNetworkingV2Network_netstack(t *testing.T) {
}

func TestAccNetworkingV2Network_fullstack(t *testing.T) {
region := os.Getenv(OS_REGION_NAME)

var instance servers.Server
var network networks.Network
var port ports.Port
Expand All @@ -102,21 +93,18 @@ func TestAccNetworkingV2Network_fullstack(t *testing.T) {

var testAccNetworkingV2Network_fullstack = fmt.Sprintf(`
resource "openstack_networking_network_v2" "foo" {
region = "%s"
name = "network_1"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "foo" {
region = "%s"
name = "subnet_1"
network_id = "${openstack_networking_network_v2.foo.id}"
cidr = "192.168.199.0/24"
ip_version = 4
}
resource "openstack_compute_secgroup_v2" "foo" {
region = "%s"
name = "secgroup_1"
description = "a security group"
rule {
Expand All @@ -128,7 +116,6 @@ func TestAccNetworkingV2Network_fullstack(t *testing.T) {
}
resource "openstack_networking_port_v2" "foo" {
region = "%s"
name = "port_1"
network_id = "${openstack_networking_network_v2.foo.id}"
admin_state_up = "true"
Expand All @@ -140,14 +127,13 @@ func TestAccNetworkingV2Network_fullstack(t *testing.T) {
}
resource "openstack_compute_instance_v2" "foo" {
region = "%s"
name = "terraform-test"
security_groups = ["${openstack_compute_secgroup_v2.foo.name}"]
network {
port = "${openstack_networking_port_v2.foo.id}"
}
}`, region, region, region, region, region)
}`)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func resourceNetworkingSubnetV2() *schema.Resource {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"start": &schema.Schema{
Expand Down

0 comments on commit f07dcd1

Please sign in to comment.