Skip to content

Commit

Permalink
Openstack LBaaS V2 Support - Refactoring resource naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
dkalleg committed Jun 6, 2016
1 parent 782e0c9 commit f73e37a
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 69 deletions.
10 changes: 5 additions & 5 deletions builtin/providers/openstack/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ func Provider() terraform.ResourceProvider {
"openstack_lb_monitor_v1": resourceLBMonitorV1(),
"openstack_lb_pool_v1": resourceLBPoolV1(),
"openstack_lb_vip_v1": resourceLBVipV1(),
"openstack_lbaas_loadbalancer_v2": resourceLoadBalancerV2(),
"openstack_lbaas_listener_v2": resourceListenerV2(),
"openstack_lbaas_pool_v2": resourcePoolV2(),
"openstack_lbaas_member_v2": resourceMemberV2(),
"openstack_lbaas_monitor_v2": resourceMonitorV2(),
"openstack_lb_loadbalancer_v2": resourceLoadBalancerV2(),
"openstack_lb_listener_v2": resourceListenerV2(),
"openstack_lb_pool_v2": resourcePoolV2(),
"openstack_lb_member_v2": resourceMemberV2(),
"openstack_lb_monitor_v2": resourceMonitorV2(),
"openstack_networking_network_v2": resourceNetworkingNetworkV2(),
"openstack_networking_subnet_v2": resourceNetworkingSubnetV2(),
"openstack_networking_floatingip_v2": resourceNetworkingFloatingIPV2(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ func TestAccLBV2Listener_basic(t *testing.T) {
resource.TestStep{
Config: TestAccLBV2ListenerConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckLBV2ListenerExists(t, "openstack_lbaas_listener_v2.listener_1", &listener),
testAccCheckLBV2ListenerExists(t, "openstack_lb_listener_v2.listener_1", &listener),
),
},
resource.TestStep{
Config: TestAccLBV2ListenerConfig_update,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("openstack_lbaas_listener_v2.listener_1", "name", "tf_test_listener_updated"),
resource.TestCheckResourceAttr("openstack_lbaas_listener_v2.listener_1", "connection_limit", "100"),
resource.TestCheckResourceAttr("openstack_lb_listener_v2.listener_1", "name", "tf_test_listener_updated"),
resource.TestCheckResourceAttr("openstack_lb_listener_v2.listener_1", "connection_limit", "100"),
),
},
},
Expand All @@ -45,7 +45,7 @@ func testAccCheckLBV2ListenerDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
log.Printf("[FINDME] rs TYPE is: %T", rs)

if rs.Type != "openstack_lbaas_listener_v2" {
if rs.Type != "openstack_lb_listener_v2" {
continue
}

Expand Down Expand Up @@ -103,15 +103,15 @@ var TestAccLBV2ListenerConfig_basic = fmt.Sprintf(`
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lbaas_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lbaas_loadbalancer_v2.loadbalancer_1.id}"
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
`)
Expand All @@ -129,15 +129,15 @@ var TestAccLBV2ListenerConfig_update = fmt.Sprintf(`
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lbaas_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lbaas_loadbalancer_v2.loadbalancer_1.id}"
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener_updated"
connection_limit = 100
admin_state_up = "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ func TestAccLBV2LoadBalancer_basic(t *testing.T) {
resource.TestStep{
Config: TestAccLBV2LoadBalancerConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckLBV2LoadBalancerExists(t, "openstack_lbaas_loadbalancer_v2.loadbalancer_1", &lb),
testAccCheckLBV2LoadBalancerExists(t, "openstack_lb_loadbalancer_v2.loadbalancer_1", &lb),
),
},
resource.TestStep{
Config: TestAccLBV2LoadBalancerConfig_update,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("openstack_lbaas_loadbalancer_v2.loadbalancer_1", "name", "tf_test_loadbalancer_v2_updated"),
resource.TestCheckResourceAttr("openstack_lb_loadbalancer_v2.loadbalancer_1", "name", "tf_test_loadbalancer_v2_updated"),
),
},
},
Expand All @@ -44,7 +44,7 @@ func testAccCheckLBV2LoadBalancerDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
log.Printf("[FINDME] rs TYPE is: %#v", rs.Type)

if rs.Type != "openstack_lbaas_loadbalancer_v2" {
if rs.Type != "openstack_lb_loadbalancer_v2" {
continue
}

Expand Down Expand Up @@ -102,7 +102,7 @@ var TestAccLBV2LoadBalancerConfig_basic = fmt.Sprintf(`
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}`)
Expand All @@ -120,7 +120,7 @@ var TestAccLBV2LoadBalancerConfig_update = fmt.Sprintf(`
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2_updated"
admin_state_up = "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ func TestAccLBV2Member_basic(t *testing.T) {
resource.TestStep{
Config: TestAccLBV2MemberConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckLBV2MemberExists(t, "openstack_lbaas_member_v2.member_1", &member),
testAccCheckLBV2MemberExists(t, "openstack_lb_member_v2.member_1", &member),
),
},
resource.TestStep{
Config: TestAccLBV2MemberConfig_update,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("openstack_lbaas_member_v2.member_1", "weight", "10"),
resource.TestCheckResourceAttr("openstack_lb_member_v2.member_1", "weight", "10"),
),
},
},
Expand All @@ -44,7 +44,7 @@ func testAccCheckLBV2MemberDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
log.Printf("[FINDME] rs TYPE is: %T", rs)

if rs.Type != "openstack_lbaas_member_v2" {
if rs.Type != "openstack_lb_member_v2" {
continue
}

Expand Down Expand Up @@ -103,28 +103,28 @@ resource "openstack_networking_subnet_v2" "subnet_1" {
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lbaas_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lbaas_loadbalancer_v2.loadbalancer_1.id}"
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lbaas_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lbaas_listener_v2.listener_1.id}"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
resource "openstack_lbaas_member_v2" "member_1" {
resource "openstack_lb_member_v2" "member_1" {
address = "192.168.199.10"
pool_id = "${openstack_lbaas_pool_v2.pool_1.id}"
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
protocol_port = 8080
subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
}`)
Expand All @@ -142,28 +142,28 @@ resource "openstack_networking_subnet_v2" "subnet_1" {
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lbaas_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lbaas_loadbalancer_v2.loadbalancer_1.id}"
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lbaas_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lbaas_listener_v2.listener_1.id}"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
resource "openstack_lbaas_member_v2" "member_1" {
resource "openstack_lb_member_v2" "member_1" {
address = "192.168.199.10"
pool_id = "${openstack_lbaas_pool_v2.pool_1.id}"
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
protocol_port = 8080
subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
weight = 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ func TestAccLBV2Monitor_basic(t *testing.T) {
resource.TestStep{
Config: TestAccLBV2MonitorConfig_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckLBV2MonitorExists(t, "openstack_lbaas_monitor_v2.monitor_1", &monitor),
testAccCheckLBV2MonitorExists(t, "openstack_lb_monitor_v2.monitor_1", &monitor),
),
},
resource.TestStep{
Config: TestAccLBV2MonitorConfig_update,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("openstack_lbaas_monitor_v2.monitor_1", "name", "tf_test_monitor_updated"),
resource.TestCheckResourceAttr("openstack_lbaas_monitor_v2.monitor_1", "delay", "30"),
resource.TestCheckResourceAttr("openstack_lbaas_monitor_v2.monitor_1", "timeout", "15"),
resource.TestCheckResourceAttr("openstack_lb_monitor_v2.monitor_1", "name", "tf_test_monitor_updated"),
resource.TestCheckResourceAttr("openstack_lb_monitor_v2.monitor_1", "delay", "30"),
resource.TestCheckResourceAttr("openstack_lb_monitor_v2.monitor_1", "timeout", "15"),
),
},
},
Expand All @@ -46,7 +46,7 @@ func testAccCheckLBV2MonitorDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
log.Printf("[FINDME] rs TYPE is: %T", rs)

if rs.Type != "openstack_lbaas_monitor_v2" {
if rs.Type != "openstack_lb_monitor_v2" {
continue
}

Expand Down Expand Up @@ -105,27 +105,27 @@ resource "openstack_networking_subnet_v2" "subnet_1" {
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lbaas_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lbaas_loadbalancer_v2.loadbalancer_1.id}"
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lbaas_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lbaas_listener_v2.listener_1.id}"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
resource "openstack_lbaas_monitor_v2" "monitor_1" {
pool_id = "${openstack_lbaas_pool_v2.pool_1.id}"
resource "openstack_lb_monitor_v2" "monitor_1" {
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
type = "PING"
delay = 20
timeout = 10
Expand All @@ -146,27 +146,27 @@ resource "openstack_networking_subnet_v2" "subnet_1" {
name = "tf_test_subnet"
}
resource "openstack_lbaas_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lbaas_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lbaas_loadbalancer_v2.loadbalancer_1.id}"
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lbaas_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lbaas_listener_v2.listener_1.id}"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
resource "openstack_lbaas_monitor_v2" "monitor_1" {
pool_id = "${openstack_lbaas_pool_v2.pool_1.id}"
resource "openstack_lb_monitor_v2" "monitor_1" {
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
type = "PING"
delay = 30
timeout = 15
Expand Down
Loading

0 comments on commit f73e37a

Please sign in to comment.