provider/openstack: Add lb_provider argument to lb_pool_v1

This commit adds the lb_provider argument to the lb_pool_v1 resource.
This argument can be used to specify a backend load balancing system.
This commit is contained in:
Joe Topjian 2016-05-28 21:46:31 +00:00
parent 8e52757fc3
commit e0d343906d
3 changed files with 15 additions and 0 deletions

View File

@ -51,6 +51,12 @@ func resourceLBPoolV1() *schema.Resource {
Required: true,
ForceNew: false,
},
"lb_provider": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
"tenant_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
@ -116,6 +122,7 @@ func resourceLBPoolV1Create(d *schema.ResourceData, meta interface{}) error {
SubnetID: d.Get("subnet_id").(string),
LBMethod: d.Get("lb_method").(string),
TenantID: d.Get("tenant_id").(string),
Provider: d.Get("lb_provider").(string),
}
log.Printf("[DEBUG] Create Options: %#v", createOpts)
@ -182,6 +189,7 @@ func resourceLBPoolV1Read(d *schema.ResourceData, meta interface{}) error {
d.Set("protocol", p.Protocol)
d.Set("subnet_id", p.SubnetID)
d.Set("lb_method", p.LBMethod)
d.Set("lb_provider", p.Provider)
d.Set("tenant_id", p.TenantID)
d.Set("monitor_ids", p.MonitorIDs)
d.Set("member_ids", p.MemberIDs)

View File

@ -28,6 +28,7 @@ func TestAccLBV1Pool_basic(t *testing.T) {
Config: testAccLBV1Pool_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckLBV1PoolExists(t, "openstack_lb_pool_v1.pool_1", &pool),
resource.TestCheckResourceAttr("openstack_lb_pool_v1.pool_1", "lb_provider", "haproxy"),
),
},
resource.TestStep{
@ -144,6 +145,7 @@ var testAccLBV1Pool_basic = fmt.Sprintf(`
protocol = "HTTP"
subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
lb_method = "ROUND_ROBIN"
lb_provider = "haproxy"
}`,
OS_REGION_NAME, OS_REGION_NAME, OS_REGION_NAME)

View File

@ -18,6 +18,7 @@ resource "openstack_lb_pool_v1" "pool_1" {
protocol = "HTTP"
subnet_id = "12345"
lb_method = "ROUND_ROBIN"
lb_provider = "haproxy"
monitor_ids = ["67890"]
}
```
@ -131,6 +132,9 @@ The following arguments are supported:
members of the pool. The current specification supports 'ROUND_ROBIN' and
'LEAST_CONNECTIONS' as valid values for this attribute.
* `lb_provider` - (Optional) The backend load balancing provider. For example:
`haproxy`, `F5`, etc.
* `tenant_id` - (Optional) The owner of the pool. Required if admin wants to
create a pool member for another tenant. Changing this creates a new pool.
@ -166,6 +170,7 @@ The following attributes are exported:
* `protocol` - See Argument Reference above.
* `subnet_id` - See Argument Reference above.
* `lb_method` - See Argument Reference above.
* `lb_provider` - See Argument Reference above.
* `tenant_id` - See Argument Reference above.
* `monitor_id` - See Argument Reference above.
* `member` - See Argument Reference above.