Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider/openstack: Add support for updating Subnet Allocation Pools #14782

Merged
merged 2 commits into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func resourceNetworkingSubnetV2() *schema.Resource {
"allocation_pools": &schema.Schema{
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -293,6 +292,10 @@ func resourceNetworkingSubnetV2Update(d *schema.ResourceData, meta interface{})
updateOpts.EnableDHCP = &v
}

if d.HasChange("allocation_pools") {
updateOpts.AllocationPools = resourceSubnetAllocationPoolsV2(d)
}

log.Printf("[DEBUG] Updating Subnet %s with options: %+v", d.Id(), updateOpts)

_, err = subnets.Update(networkingClient, d.Id(), updateOpts).Extract()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func TestAccNetworkingV2Subnet_basic(t *testing.T) {
Config: testAccNetworkingV2Subnet_basic,
Check: resource.ComposeTestCheckFunc(
testAccCheckNetworkingV2SubnetExists("openstack_networking_subnet_v2.subnet_1", &subnet),
resource.TestCheckResourceAttr(
"openstack_networking_subnet_v2.subnet_1", "allocation_pools.0.start", "192.168.199.100"),
),
},
resource.TestStep{
Expand All @@ -33,6 +35,8 @@ func TestAccNetworkingV2Subnet_basic(t *testing.T) {
"openstack_networking_subnet_v2.subnet_1", "gateway_ip", "192.168.199.1"),
resource.TestCheckResourceAttr(
"openstack_networking_subnet_v2.subnet_1", "enable_dhcp", "true"),
resource.TestCheckResourceAttr(
"openstack_networking_subnet_v2.subnet_1", "allocation_pools.0.start", "192.168.199.150"),
),
},
},
Expand Down Expand Up @@ -220,7 +224,7 @@ resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"

allocation_pools {
start = "192.168.199.100"
start = "192.168.199.150"
end = "192.168.199.200"
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -1853,10 +1853,10 @@
"revisionTime": "2017-03-10T01:59:53Z"
},
{
"checksumSHA1": "wY0MY7RpX0Z2Y0rMmrAuYS6cHYA=",
"checksumSHA1": "mNRf4F3OjUIivhWTPZD/FjJNuCk=",
"path": "github.com/gophercloud/gophercloud/openstack/networking/v2/subnets",
"revision": "0f64da0e36de86a0ca1a8f2fc1b0570a0d3f7504",
"revisionTime": "2017-03-10T01:59:53Z"
"revision": "4f943e86d0a2c2e1c5c040e00a1358079c0881a1",
"revisionTime": "2017-05-24T02:11:01Z"
},
{
"checksumSHA1": "LtdQKIKKRKe6FOGdBvrBz/bg1Gc=",
Expand Down