provider/openstack: LoadBalancer v2 VIP Port ID (#9727)

This commit adds vip_port_id as an exported attribute to the
lb_loadbalancer_v2 resource.
This commit is contained in:
Joe Topjian 2016-11-01 04:25:18 -06:00 committed by Paul Stack
parent 91cb3e2833
commit b269b417b0
3 changed files with 13 additions and 4 deletions

View File

@ -57,6 +57,11 @@ func resourceLoadBalancerV2() *schema.Resource {
ForceNew: true, ForceNew: true,
}, },
"vip_port_id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
"admin_state_up": &schema.Schema{ "admin_state_up": &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Default: true, Default: true,
@ -145,6 +150,7 @@ func resourceLoadBalancerV2Read(d *schema.ResourceData, meta interface{}) error
d.Set("vip_subnet_id", lb.VipSubnetID) d.Set("vip_subnet_id", lb.VipSubnetID)
d.Set("tenant_id", lb.TenantID) d.Set("tenant_id", lb.TenantID)
d.Set("vip_address", lb.VipAddress) d.Set("vip_address", lb.VipAddress)
d.Set("vip_port_id", lb.VipPortID)
d.Set("admin_state_up", lb.AdminStateUp) d.Set("admin_state_up", lb.AdminStateUp)
d.Set("flavor", lb.Flavor) d.Set("flavor", lb.Flavor)
d.Set("provider", lb.Provider) d.Set("provider", lb.Provider)

View File

@ -2,6 +2,7 @@ package openstack
import ( import (
"fmt" "fmt"
"regexp"
"testing" "testing"
"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/loadbalancers" "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/lbaas_v2/loadbalancers"
@ -27,6 +28,7 @@ func TestAccLBV2LoadBalancer_basic(t *testing.T) {
Config: TestAccLBV2LoadBalancerConfig_update, Config: TestAccLBV2LoadBalancerConfig_update,
Check: resource.ComposeTestCheckFunc( Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("openstack_lb_loadbalancer_v2.loadbalancer_1", "name", "tf_test_loadbalancer_v2_updated"), resource.TestCheckResourceAttr("openstack_lb_loadbalancer_v2.loadbalancer_1", "name", "tf_test_loadbalancer_v2_updated"),
resource.TestMatchResourceAttr("openstack_lb_loadbalancer_v2.loadbalancer_1", "vip_port_id", regexp.MustCompile("^[a-f0-9-]+")),
), ),
}, },
}, },

View File

@ -66,3 +66,4 @@ The following attributes are exported:
* `admin_state_up` - See Argument Reference above. * `admin_state_up` - See Argument Reference above.
* `flavor` - See Argument Reference above. * `flavor` - See Argument Reference above.
* `provider` - See Argument Reference above. * `provider` - See Argument Reference above.
* `vip_port_id` - The Port ID of the Load Balancer IP.