From e0d343906d7de261a240e3d731153df39fd1b7c7 Mon Sep 17 00:00:00 2001 From: Joe Topjian Date: Sat, 28 May 2016 21:46:31 +0000 Subject: [PATCH] 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. --- .../providers/openstack/resource_openstack_lb_pool_v1.go | 8 ++++++++ .../openstack/resource_openstack_lb_pool_v1_test.go | 2 ++ .../docs/providers/openstack/r/lb_pool_v1.html.markdown | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/builtin/providers/openstack/resource_openstack_lb_pool_v1.go b/builtin/providers/openstack/resource_openstack_lb_pool_v1.go index 6eaac9a13..345d2b166 100644 --- a/builtin/providers/openstack/resource_openstack_lb_pool_v1.go +++ b/builtin/providers/openstack/resource_openstack_lb_pool_v1.go @@ -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) diff --git a/builtin/providers/openstack/resource_openstack_lb_pool_v1_test.go b/builtin/providers/openstack/resource_openstack_lb_pool_v1_test.go index c1fb60c25..8264a32c9 100644 --- a/builtin/providers/openstack/resource_openstack_lb_pool_v1_test.go +++ b/builtin/providers/openstack/resource_openstack_lb_pool_v1_test.go @@ -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) diff --git a/website/source/docs/providers/openstack/r/lb_pool_v1.html.markdown b/website/source/docs/providers/openstack/r/lb_pool_v1.html.markdown index c242f05dd..c1439421d 100644 --- a/website/source/docs/providers/openstack/r/lb_pool_v1.html.markdown +++ b/website/source/docs/providers/openstack/r/lb_pool_v1.html.markdown @@ -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.