neutron network operations

This commit is contained in:
Jon Perritt 2015-01-14 11:56:52 -07:00
parent c2230a8aaa
commit ef3ee11045
2 changed files with 52 additions and 11 deletions

View File

@ -38,7 +38,7 @@ func resourceNetworkingNetwork() *schema.Resource {
"tenant_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: false,
ForceNew: true,
},
},
}
@ -157,19 +157,13 @@ func resourceNetworkingNetworkUpdate(d *schema.ResourceData, meta interface{}) e
updateOpts.Shared = &shared
}
}
if d.HasChange("tenant_id") {
updateOpts.TenantID = d.Get("tenant_id").(string)
}
// If there's nothing to update, don't waste an HTTP call.
if updateOpts != (networks.UpdateOpts{}) {
log.Printf("[DEBUG] Updating Network %s with options: %+v", d.Id(), updateOpts)
_, err := networks.Update(osClient, d.Id(), updateOpts).Extract()
if err != nil {
return fmt.Errorf("Error updating OpenStack Neutron Network: %s", err)
}
}
return resourceNetworkingNetworkRead(d, meta)
}

View File

@ -0,0 +1,47 @@
---
layout: "openstack"
page_title: "OpenStack: openstack_networking_network"
sidebar_current: "docs-openstack-resource-networking-network"
description: |-
Manages a Neutron network resource within OpenStack.
---
# openstack\_networking\_network
Manages a Neutron network resource within OpenStack.
## Example Usage
```
resource "openstack_networking_network" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Optional) The name of the network. Changing this updates the name of
the existing network.
* `shared` - (Optional) Specifies whether the network resource can be accessed
by any tenant or not. Changing this updates the sharing capabalities of the
existing network.
* `tenant_id` - (Optional) The owner of the newtork. Required if admin wants to
create a network for another tenant. Changing this creates a new network.
* `admin_state_up` - (Optional) The administrative state of the network.
Acceptable values are "true" and "false". Changing this value updates the
state of the existing network.
## Attributes Reference
The following attributes are exported:
* `name` - See Argument Reference above.
* `shared` - See Argument Reference above.
* `tenant_id` - See Argument Reference above.
* `admin_state_up` - See Argument Reference above.