Skip to content

Commit

Permalink
Add DriverOpts for Openstack routers
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Shirinkin authored and Kirill Shirinkin committed Feb 4, 2016
1 parent 3792bd6 commit 2474f60
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ func resourceNetworkingRouterV2() *schema.Resource {
ForceNew: true,
Computed: true,
},
"driver_opts": &schema.Schema{
Type: schema.TypeMap,
Optional: true,
ForceNew: true,
},
},
}
}
Expand All @@ -60,8 +65,9 @@ func resourceNetworkingRouterV2Create(d *schema.ResourceData, meta interface{})
}

createOpts := routers.CreateOpts{
Name: d.Get("name").(string),
TenantID: d.Get("tenant_id").(string),
Name: d.Get("name").(string),
TenantID: d.Get("tenant_id").(string),
DriverOpts: routerDriverOpts(d),
}

if asuRaw, ok := d.GetOk("admin_state_up"); ok {
Expand Down Expand Up @@ -227,3 +233,11 @@ func waitForRouterDelete(networkingClient *gophercloud.ServiceClient, routerId s
return r, "ACTIVE", nil
}
}

func routerDriverOpts(d *schema.ResourceData) map[string]string {
m := make(map[string]string)
for key, val := range d.Get("driver_opts").(map[string]interface{}) {
m[key] = val.(string)
}
return m
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ The following arguments are supported:
* `tenant_id` - (Optional) The owner of the floating IP. Required if admin wants
to create a router for another tenant. Changing this creates a new router.

* `driver_opts` - (Optional) Map of additional driver-specific options.

## Attributes Reference

The following attributes are exported:
Expand All @@ -53,3 +55,4 @@ The following attributes are exported:
* `admin_state_up` - See Argument Reference above.
* `external_gateway` - See Argument Reference above.
* `tenant_id` - See Argument Reference above.
* `driver_opts` - See Argument Reference above.

0 comments on commit 2474f60

Please sign in to comment.