-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tags support for Neutron networks
This allows us to set/get tags for networks via terraform templates, and requires the recently added changes to gophercloud that enable the relevant features of the Neutron APIs to be accessed. Note the test is added in a new resource_openstack_networking_tags_v2_test.go file, so that we can reduce duplication later in the series e.g subnet/port/trunk resources can share the same template which should be faster. Issue: terraform-provider-openstack#453
- Loading branch information
Steven Hardy
committed
Oct 25, 2018
1 parent
154050d
commit a2165fd
Showing
3 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package openstack | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccNetworkingV2_tags(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckNetworkingV2NetworkDestroy, | ||
Steps: []resource.TestStep{ | ||
resource.TestStep{ | ||
Config: testAccNetworkingV2_tags, | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckNetworkingV2Tags( | ||
"openstack_networking_network_v2.network_1", | ||
[]string{"a", "b", "c"}), | ||
), | ||
}, | ||
resource.TestStep{ | ||
Config: testAccNetworkingV2_tags_update, | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckNetworkingV2Tags( | ||
"openstack_networking_network_v2.network_1", | ||
[]string{"a", "b", "c", "d"}), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
const testAccNetworkingV2_tags = ` | ||
resource "openstack_networking_network_v2" "network_1" { | ||
name = "network_1" | ||
admin_state_up = "true" | ||
tags = ["a", "b", "c"] | ||
} | ||
` | ||
|
||
const testAccNetworkingV2_tags_update = ` | ||
resource "openstack_networking_network_v2" "network_1" { | ||
name = "network_1" | ||
admin_state_up = "true" | ||
tags = ["a", "b", "c", "d"] | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters