Skip to content

Commit

Permalink
fix: remove deprecated min_vid and max_vid
Browse files Browse the repository at this point in the history
  • Loading branch information
sjurtf committed Sep 27, 2024
1 parent 79ed82f commit 999cee6
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 70 deletions.
2 changes: 0 additions & 2 deletions docs/data-sources/vlan_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ data "netbox_vlan_group" "example3" {

- `description` (String)
- `id` (String) The ID of this resource.
- `max_vid` (Number)
- `min_vid` (Number)
- `vlan_count` (Number)


3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Netbox often makes breaking API changes even in non-major releases. Check the ta

| Netbox version | Provider version |
| --------------- | ---------------- |
| v4.0.0 - 4.0.10 | v3.9.0 and up |
| v4.1.0 - 4.1.2 | v3.10.0 and up |
| v4.0.0 - 4.0.10 | v3.9.0 - 3.9.1 |
| v3.7.0 - 3.7.8 | v3.8.0 - 3.8.9 |
| v3.6.0 - 3.6.9 | v3.7.0 - 3.7.7 |
| v3.5.1 - 3.5.9 | v3.6.x |
Expand Down
1 change: 0 additions & 1 deletion docs/resources/rack.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ resource "netbox_rack" "test" {
- `serial` (String)
- `tags` (Set of String)
- `tenant_id` (Number)
- `type` (String) Valid values are `2-post-frame`, `4-post-frame`, `4-post-cabinet`, `wall-frame`, `wall-frame-vertical`, `wall-cabinet` and `wall-cabinet-vertical`.
- `weight` (Number)
- `weight_unit` (String) Valid values are `kg`, `g`, `lb` and `oz`. Required when `weight` and `max_weight` is set.

Expand Down
6 changes: 0 additions & 6 deletions docs/resources/vlan_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ description: |-
resource "netbox_vlan_group" "example1" {
name = "example1"
slug = "example1"
min_vid = 1
max_vid = 4094
}
#Full VLAN Group example
resource "netbox_vlan_group" "example2" {
name = "Second Example"
slug = "example2"
min_vid = 1
max_vid = 4094
scope_type = "dcim.site"
scope_id = netbox_site.example.id
description = "Second Example VLAN Group"
Expand All @@ -39,8 +35,6 @@ resource "netbox_vlan_group" "example2" {

### Required

- `max_vid` (Number)
- `min_vid` (Number)
- `name` (String)
- `slug` (String)

Expand Down
4 changes: 0 additions & 4 deletions examples/resources/netbox_vlan_group/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
resource "netbox_vlan_group" "example1" {
name = "example1"
slug = "example1"
min_vid = 1
max_vid = 4094
}

#Full VLAN Group example
resource "netbox_vlan_group" "example2" {
name = "Second Example"
slug = "example2"
min_vid = 1
max_vid = 4094
scope_type = "dcim.site"
scope_id = netbox_site.example.id
description = "Second Example VLAN Group"
Expand Down
10 changes: 0 additions & 10 deletions netbox/data_source_netbox_vlan_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ func dataSourceNetboxVlanGroup() *schema.Resource {
Optional: true,
RequiredWith: []string{"scope_type"},
},
"min_vid": {
Type: schema.TypeInt,
Computed: true,
},
"max_vid": {
Type: schema.TypeInt,
Computed: true,
},
"vlan_count": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -92,8 +84,6 @@ func dataSourceNetboxVlanGroupRead(d *schema.ResourceData, m interface{}) error
d.SetId(strconv.FormatInt(result.ID, 10))
d.Set("name", result.Name)
d.Set("slug", result.Slug)
d.Set("min_vid", result.MinVid)
d.Set("max_vid", result.MaxVid)
d.Set("vlan_count", result.VlanCount)
d.Set("description", result.Description)
return nil
Expand Down
10 changes: 0 additions & 10 deletions netbox/data_source_netbox_vlan_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ func TestAccNetboxVlanGroupDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "name", testName),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "slug", testSlug),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "description", "Test"),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "min_vid", "20"),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "max_vid", "200"),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "scope_type", "dcim.site"),
resource.TestCheckResourceAttrPair("data.netbox_vlan_group.test", "scope_id", "netbox_site.test", "id"),
),
Expand All @@ -56,8 +54,6 @@ func TestAccNetboxVlanGroupDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "name", testName),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "slug", testSlug),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "description", "Test"),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "min_vid", "20"),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "max_vid", "200"),
resource.TestCheckResourceAttr("data.netbox_vlan_group.test", "scope_type", "dcim.site"),
resource.TestCheckResourceAttrPair("data.netbox_vlan_group.test", "scope_id", "netbox_site.test", "id"),
),
Expand All @@ -84,8 +80,6 @@ resource "netbox_vlan_group" "test" {
slug = "%[1]s"
name = "%[2]s"
description = "Test"
min_vid = 20
max_vid = 200
scope_type = "dcim.site"
scope_id = netbox_site.test.id
tags = []
Expand All @@ -98,15 +92,11 @@ func testAccNetboxVlanGroupSetUpMore(testSlug, anotherSlug, testName string) str
resource "netbox_vlan_group" "same_name" {
slug = "%[1]s"
name = "%[3]s"
min_vid = 20
max_vid = 200
}
resource "netbox_vlan_group" "not_same" {
slug = "%[2]s"
name = "%[3]s_unique"
min_vid = 20
max_vid = 200
}
`, testSlug, anotherSlug, testName)
}
Expand Down
20 changes: 0 additions & 20 deletions netbox/resource_netbox_vlan_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ func resourceNetboxVlanGroup() *schema.Resource {
Required: true,
ValidateFunc: validation.StringLenBetween(1, 100),
},
"min_vid": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(1, 4093),
},
"max_vid": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(2, 4094),
},
"scope_type": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -73,14 +63,10 @@ func resourceNetboxVlanGroupCreate(d *schema.ResourceData, m interface{}) error

name := d.Get("name").(string)
slug := d.Get("slug").(string)
minVid := int64(d.Get("min_vid").(int))
maxVid := int64(d.Get("max_vid").(int))
description := d.Get("description").(string)

data.Name = &name
data.Slug = &slug
data.MinVid = minVid
data.MaxVid = maxVid
data.Description = description

if scopeType, ok := d.GetOk("scope_type"); ok {
Expand Down Expand Up @@ -125,8 +111,6 @@ func resourceNetboxVlanGroupRead(d *schema.ResourceData, m interface{}) error {

d.Set("name", vlanGroup.Name)
d.Set("slug", vlanGroup.Slug)
d.Set("min_vid", vlanGroup.MinVid)
d.Set("max_vid", vlanGroup.MaxVid)
d.Set("description", vlanGroup.Description)
d.Set(tagsKey, getTagListFromNestedTagList(vlanGroup.Tags))

Expand All @@ -148,14 +132,10 @@ func resourceNetboxVlanGroupUpdate(d *schema.ResourceData, m interface{}) error

name := d.Get("name").(string)
slug := d.Get("slug").(string)
minVid := int64(d.Get("min_vid").(int))
maxVid := int64(d.Get("max_vid").(int))
description := d.Get("description").(string)

data.Name = &name
data.Slug = &slug
data.MinVid = minVid
data.MaxVid = maxVid
data.Description = description

if scopeType, ok := d.GetOk("scope_type"); ok {
Expand Down
16 changes: 2 additions & 14 deletions netbox/resource_netbox_vlan_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ resource "netbox_site" "test" {
func TestAccNetboxVlanGroup_basic(t *testing.T) {
testSlug := "vlan_group_basic"
testName := testAccGetTestName(testSlug)
testMinVid := "777"
testMaxVid := "1777"
resource.ParallelTest(t, resource.TestCase{
Providers: testAccProviders,
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -37,15 +35,11 @@ func TestAccNetboxVlanGroup_basic(t *testing.T) {
resource "netbox_vlan_group" "test_basic" {
name = "%s"
slug = "%s"
min_vid = "%s"
max_vid = "%s"
tags = []
}`, testName, testSlug, testMinVid, testMaxVid),
}`, testName, testSlug),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netbox_vlan_group.test_basic", "name", testName),
resource.TestCheckResourceAttr("netbox_vlan_group.test_basic", "slug", testSlug),
resource.TestCheckResourceAttr("netbox_vlan_group.test_basic", "min_vid", testMinVid),
resource.TestCheckResourceAttr("netbox_vlan_group.test_basic", "max_vid", testMaxVid),
resource.TestCheckResourceAttr("netbox_vlan_group.test_basic", "description", ""),
resource.TestCheckResourceAttr("netbox_vlan_group.test_basic", "tags.#", "0"),
),
Expand All @@ -62,8 +56,6 @@ resource "netbox_vlan_group" "test_basic" {
func TestAccNetboxVlanGroup_with_dependencies(t *testing.T) {
testSlug := "vlan_group_with_dependencies"
testName := testAccGetTestName(testSlug)
testMinVid := "777"
testMaxVid := "1777"
testDescription := "Test Description"
resource.ParallelTest(t, resource.TestCase{
Providers: testAccProviders,
Expand All @@ -75,17 +67,13 @@ resource "netbox_vlan_group" "test_with_dependencies" {
name = "%s"
slug = "%s"
description = "%s"
min_vid = "%s"
max_vid = "%s"
scope_type = "dcim.site"
scope_id = netbox_site.test.id
tags = [netbox_tag.test.name]
}`, testName, testSlug, testDescription, testMinVid, testMaxVid),
}`, testName, testSlug, testDescription),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netbox_vlan_group.test_with_dependencies", "name", testName),
resource.TestCheckResourceAttr("netbox_vlan_group.test_with_dependencies", "slug", testSlug),
resource.TestCheckResourceAttr("netbox_vlan_group.test_with_dependencies", "min_vid", testMinVid),
resource.TestCheckResourceAttr("netbox_vlan_group.test_with_dependencies", "max_vid", testMaxVid),
resource.TestCheckResourceAttr("netbox_vlan_group.test_with_dependencies", "description", testDescription),
resource.TestCheckResourceAttr("netbox_vlan_group.test_with_dependencies", "scope_type", "dcim.site"),
resource.TestCheckResourceAttrPair("netbox_vlan_group.test_with_dependencies", "scope_id", "netbox_site.test", "id"),
Expand Down
2 changes: 0 additions & 2 deletions netbox/resource_netbox_vlan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ resource "netbox_site" "test" {
resource "netbox_vlan_group" "test_group" {
name = "%[1]s"
slug = "%[1]s"
min_vid = 1
max_vid = 4094
scope_type = "dcim.site"
scope_id = netbox_site.test.id
}
Expand Down

0 comments on commit 999cee6

Please sign in to comment.