From ef3ee11045e09925f40009acc72be023c1e7fdbe Mon Sep 17 00:00:00 2001 From: Jon Perritt Date: Wed, 14 Jan 2015 11:56:52 -0700 Subject: [PATCH] neutron network operations --- .../resource_openstack_networking_network.go | 16 ++----- .../r/networking_network.html.markdown | 47 +++++++++++++++++++ 2 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 website/source/docs/providers/openstack/r/networking_network.html.markdown diff --git a/builtin/providers/openstack/resource_openstack_networking_network.go b/builtin/providers/openstack/resource_openstack_networking_network.go index c819aa0f4..8f262e369 100644 --- a/builtin/providers/openstack/resource_openstack_networking_network.go +++ b/builtin/providers/openstack/resource_openstack_networking_network.go @@ -38,7 +38,7 @@ func resourceNetworkingNetwork() *schema.Resource { "tenant_id": &schema.Schema{ Type: schema.TypeString, Optional: true, - ForceNew: false, + ForceNew: true, }, }, } @@ -157,18 +157,12 @@ 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) + 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) - } + _, 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) diff --git a/website/source/docs/providers/openstack/r/networking_network.html.markdown b/website/source/docs/providers/openstack/r/networking_network.html.markdown new file mode 100644 index 000000000..eb765cac0 --- /dev/null +++ b/website/source/docs/providers/openstack/r/networking_network.html.markdown @@ -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.