Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: graysonwu <[email protected]>
  • Loading branch information
GraysonWu committed Aug 2, 2023
1 parent 1f961f3 commit b661622
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 8 deletions.
4 changes: 2 additions & 2 deletions nsxt/resource_nsxt_policy_vni_pool.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright © 2019 VMware, Inc. All Rights Reserved.
/* Copyright © 2023 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: MPL-2.0 */

package nsxt
Expand All @@ -21,7 +21,7 @@ func resourceNsxtPolicyVniPool() *schema.Resource {
Update: resourceNsxtPolicyVniPoolUpdate,
Delete: resourceNsxtPolicyVniPoolDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
State: nsxtPolicyPathResourceImporter,
},

Schema: map[string]*schema.Schema{
Expand Down
12 changes: 9 additions & 3 deletions nsxt/resource_nsxt_policy_vni_pool_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright © 2020 VMware, Inc. All Rights Reserved.
/* Copyright © 2023 VMware, Inc. All Rights Reserved.
SPDX-License-Identifier: MPL-2.0 */

package nsxt
Expand Down Expand Up @@ -29,7 +29,10 @@ func TestAccResourceNsxtPolicyVniPool_basic(t *testing.T) {
testResourceName := "nsxt_policy_vni_pool.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() {
testAccOnlyLocalManager(t)
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: func(state *terraform.State) error {
return testAccNsxtPolicyVniPoolCheckDestroy(state, accTestPolicyVniPoolUpdateAttributes["display_name"])
Expand Down Expand Up @@ -73,7 +76,10 @@ func TestAccResourceNsxtPolicyVniPool_importBasic(t *testing.T) {
testResourceName := "nsxt_policy_vni_pool.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() {
testAccOnlyLocalManager(t)
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: func(state *terraform.State) error {
return testAccNsxtPolicyVniPoolCheckDestroy(state, accTestPolicyVniPoolUpdateAttributes["display_name"])
Expand Down
6 changes: 3 additions & 3 deletions website/docs/d/policy_vni_pool.html.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
subcategory: "Segments"
subcategory: "EVPN"
layout: "nsxt"
page_title: "NSXT: policy_vni_pool"
description: Policy VNI Pool Config data source.
Expand Down Expand Up @@ -32,5 +32,5 @@ In addition to arguments listed above, the following attributes are exported:

* `description` - The description of the resource.
* `path` - The NSX path of the policy resource.
* `start` - The start range of VNI Pool.
* `end` - The end range of VNI Pool.
* `start` - The start range of VNI Pool. Minimum: 75001, Maximum: 16777215.
* `end` - The end range of VNI Pool. Minimum: 75001, Maximum: 16777215.
61 changes: 61 additions & 0 deletions website/docs/r/policy_vni_pool.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
subcategory: "EVPN"
layout: "nsxt"
page_title: "NSXT: nsxt_policy_vni_pool"
description: A resource to configure VNI Pool on NSX Policy manager.
---

# nsxt_policy_vni_pool

This resource provides a method for the management of VNI Pools.

This resource is applicable to NSX Policy Manager.

This resource is supported with NSX 3.0.0 onwards.

## Example Usage

```hcl
resource "nsxt_policy_vni_pool" "test_vni_pool" {
description = "vnipool1"
display_name = "terraform provisioned VNI pool"
start = 80000
end = 90000
tag {
scope = "color"
tag = "red"
}
}
```

## Argument Reference

The following arguments are supported:

* `display_name` - (Required) Display name of the resource.
* `description` - (Optional) Description of the resource.
* `tag` - (Optional) A list of scope + tag pairs to associate with this resource.
* `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the policy resource.
* `start` - (Required) Start value of VNI Pool range. Minimum: 75001, Maximum: 16777215.
* `end` - (Required) End value of VNI Pool range. Minimum: 75001, Maximum: 16777215.

## Attributes Reference

In addition to arguments listed above, the following attributes are exported:

* `revision` - Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
* `path` - The NSX path of the policy resource.

## Importing

An existing VNI Pool can be [imported][docs-import] into this resource, via the following command:

[docs-import]: https://www.terraform.io/cli/import

```
terraform import nsxt_policy_vni_pool.vnipool1 ID
```

The above command imports VNI Pool named `vnipool1` with the NSX Policy ID `ID`.

0 comments on commit b661622

Please sign in to comment.