Skip to content

Commit

Permalink
Support distributed routers
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Shirinkin committed Jan 28, 2016
1 parent 3792bd6 commit df4b908
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func resourceNetworkingRouterV2() *schema.Resource {
ForceNew: false,
Computed: true,
},
"distributed": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Computed: true,
},
"external_gateway": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -69,6 +75,11 @@ func resourceNetworkingRouterV2Create(d *schema.ResourceData, meta interface{})
createOpts.AdminStateUp = &asu
}

if dRaw, ok := d.GetOk("distributed"); ok {
d := dRaw.(bool)
createOpts.Distributed = &d
}

externalGateway := d.Get("external_gateway").(string)
if externalGateway != "" {
gatewayInfo := routers.GatewayInfo{
Expand Down Expand Up @@ -126,6 +137,7 @@ func resourceNetworkingRouterV2Read(d *schema.ResourceData, meta interface{}) er

d.Set("name", n.Name)
d.Set("admin_state_up", n.AdminStateUp)
d.Set("distributed", n.Distributed)
d.Set("tenant_id", n.TenantID)
d.Set("external_gateway", n.GatewayInfo.NetworkID)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ var testAccNetworkingV2Router_basic = fmt.Sprintf(`
resource "openstack_networking_router_v2" "foo" {
name = "router"
admin_state_up = "true"
distributed = "false"
}`)

var testAccNetworkingV2Router_update = fmt.Sprintf(`
resource "openstack_networking_router_v2" "foo" {
name = "router_2"
admin_state_up = "true"
distributed = "false"
}`)
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ The following arguments are supported:
(must be "true" or "false" if provided). Changing this updates the
`admin_state_up` of an existing router.

* `distributed` - (Optional) Indicated whether or not to create a
distributed router. The default policy setting in Neutron restricts
usage of this property to administrative users only.

* `external_gateway` - (Optional) The network UUID of an external gateway for
the router. A router with an external gateway is required if any compute
instances or load balancers will be using floating IPs. Changing this
Expand Down

0 comments on commit df4b908

Please sign in to comment.