Skip to content

Commit 8d5633e

Browse files
committed
feat: Update provider to work with Netbox 2.9
1 parent 461299a commit 8d5633e

File tree

766 files changed

+38189
-9177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

766 files changed

+38189
-9177
lines changed

docs/resources/ipam_ip_addresses.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ Manages an ipam ip addresses resource within Netbox.
88
resource "netbox_ipam_ip_addresses" "ip_test" {
99
address = "192.168.56.0/24"
1010
description = "IP created by terraform"
11-
tags = ["tag1"]
1211
status = "active"
12+
13+
tag {
14+
name = "tag1"
15+
slug = "tag1"
16+
}
1317
}
1418
```
1519

@@ -24,12 +28,13 @@ The following arguments are supported:
2428
* ``nat_outside_id`` - (Optional) The ID of the NAT outside of this object.
2529
* ``role`` - (Optional) The role among loopback, secondary, anycast, vip, vrrp, hsrp, glbp, carp of this object.
2630
* ``status`` - (Optional) The status among container, active, reserved, deprecated (active by default).
27-
* ``tags`` - (Optional) Array of tags for this object.
2831
* ``tenant_id`` - (Optional) ID of the tenant where this object is attached.
2932
* ``vrf_id`` - (Optional) The ID of the vrf attached to this object.
33+
The ``tag`` block supports:
34+
* ``name`` - (Required) Name of the existing tag to associate with this resource.
35+
* ``slug`` - (Required) Slug of the existing tag to associate with this resource.
3036

3137
## Attributes Reference
3238

3339
In addition to the above arguments, the following attributes are exported:
3440
* ``id`` - The id (ref in Netbox) of this object.
35-

docs/resources/ipam_prefix.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ resource "netbox_ipam_prefix" "prefix_test" {
1111
description = "Prefix created by terraform"
1212
site_id = netbox_ipam_vlan_group.vlan_group_test.site_id
1313
role_id = data.netbox_ipam_roles.vlan_role_production.id
14-
tags = ["tag1"]
1514
status = "active"
15+
16+
tag {
17+
name = "tag1"
18+
slug = "tag1"
19+
}
1620
}
1721
```
1822

@@ -25,10 +29,12 @@ The following arguments are supported:
2529
* ``role_id`` - (Optional) The ID of the role attached to this object.
2630
* ``site_id`` - (Optional) ID of the site where this object is created
2731
* ``status`` - (Optional) The status among container, active, reserved, deprecated (active by default).
28-
* ``tags`` - (Optional) Array of tags for this object.
2932
* ``tenant_id`` - (Optional) ID of the tenant where this object is attached.
3033
* ``vlan_id`` - (Optional) ID of the vlan where this object is attached.
3134
* ``vrf_id`` - (Optional) The ID of the vrf attached to this object.
35+
The ``tag`` block supports:
36+
* ``name`` - (Required) Name of the existing tag to associate with this resource.
37+
* ``slug`` - (Required) Slug of the existing tag to associate with this resource.
3238

3339
## Attributes Reference
3440

docs/resources/ipam_vlan.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ resource "netbox_ipam_vlan" "vlan_test" {
1313
vlan_group_id = netbox_ipam_vlan_group.vlan_group_test.id
1414
tenant_id = netbox_tenancy_tenant.tenant_test.id
1515
role_id = data.netbox_ipam_roles.vlan_role_production.id
16-
tags = ["tag1"]
16+
17+
tag {
18+
name = "tag1"
19+
slug = "tag1"
20+
}
1721
}
1822
```
1923

@@ -26,9 +30,11 @@ The following arguments are supported:
2630
* ``role_id`` - (Optional) The ID of the role attached to this object.
2731
* ``site_id`` - (Optional) ID of the site where this object is created.
2832
* ``status`` - (Optional) The status among container, active, reserved, deprecated (active by default).
29-
* ``tags`` - (Optional) Array of tags for this vlan.
3033
* ``tenant_id`` - (Optional) ID of the tenant where this object is attached.
3134
* ``vlan_id`` - (Required) The ID of this vlan (vlan tag).
35+
The ``tag`` block supports:
36+
* ``name`` - (Required) Name of the existing tag to associate with this resource.
37+
* ``slug`` - (Required) Slug of the existing tag to associate with this resource.
3238

3339
## Attributes Reference
3440

docs/resources/tenancy_tenant.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ resource "netbox_tenancy_tenant" "tenant_test" {
1111
description = "Tenant created by terraform"
1212
comments = "Some test comments"
1313
tenant_group_id = netbox_tenancy_tenant_group.tenant_group_test.id
14-
tags = ["tag1"]
14+
15+
tag {
16+
name = "tag1"
17+
slug = "tag1"
18+
}
1519
}
1620
```
1721

@@ -23,7 +27,9 @@ The following arguments are supported:
2327
* ``tenant_group_id`` - (Optional) ID of the group where this object is located.
2428
* ``name`` - (Required) The name for this object.
2529
* ``slug`` - (Required) The slug for this object.
26-
* ``tags`` - (Optional) Array of tags for this tenant.
30+
The ``tag`` block supports:
31+
* ``name`` - (Required) Name of the existing tag to associate with this resource.
32+
* ``slug`` - (Required) Slug of the existing tag to associate with this resource.
2733

2834
## Attributes Reference
2935

examples/main.tf

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ resource "netbox_tenancy_tenant" "tenant_test" {
44
description = "Tenant created by terraform"
55
comments = "Some test comments"
66
tenant_group_id = netbox_tenancy_tenant_group.tenant_group_test.id
7-
tags = ["tag1", "tag3"]
7+
8+
tag {
9+
name = "tag1"
10+
slug = "tag1"
11+
}
12+
13+
tag {
14+
name = "tag2"
15+
slug = "tag2"
16+
}
817
}
918

1019
resource "netbox_tenancy_tenant_group" "tenant_group_test" {
@@ -38,7 +47,16 @@ resource "netbox_ipam_vlan" "vlan_test" {
3847
vlan_group_id = netbox_ipam_vlan_group.vlan_group_test.id
3948
tenant_id = netbox_tenancy_tenant.tenant_test.id
4049
role_id = data.netbox_ipam_role.vlan_role_production.id
41-
tags = ["tag1"]
50+
51+
tag {
52+
name = "tag1"
53+
slug = "tag1"
54+
}
55+
56+
tag {
57+
name = "tag2"
58+
slug = "tag2"
59+
}
4260
}
4361

4462
resource "netbox_ipam_prefix" "prefix_test" {
@@ -47,12 +65,30 @@ resource "netbox_ipam_prefix" "prefix_test" {
4765
description = "Prefix created by terraform"
4866
site_id = netbox_ipam_vlan_group.vlan_group_test.site_id
4967
role_id = data.netbox_ipam_role.vlan_role_production.id
50-
tags = ["tag1"]
51-
status = "container"
68+
69+
tag {
70+
name = "tag1"
71+
slug = "tag1"
72+
}
73+
74+
tag {
75+
name = "tag2"
76+
slug = "tag2"
77+
}
5278
}
5379

5480
resource "netbox_ipam_ip_addresses" "ip_test" {
5581
address = "192.168.56.1/24"
5682
status = "active"
5783
tenant_id = netbox_tenancy_tenant.tenant_test.id
84+
85+
tag {
86+
name = "tag1"
87+
slug = "tag1"
88+
}
89+
90+
tag {
91+
name = "tag2"
92+
slug = "tag2"
93+
}
5894
}

examples/provider.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
terraform {
2+
required_providers {
3+
netbox = {
4+
source = "registry.terraform.io/smutel/netbox"
5+
version = "0.0.1"
6+
}
7+
}
8+
}
9+

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ module github.com/smutel/terraform-provider-netbox
33
go 1.14
44

55
require (
6-
github.com/go-openapi/runtime v0.19.15
6+
github.com/go-openapi/runtime v0.19.21
77
github.com/go-openapi/strfmt v0.19.5
88
github.com/hashicorp/terraform-plugin-sdk v1.13.0
9-
github.com/netbox-community/go-netbox v0.0.0-20200527232624-eea85738db88
9+
github.com/netbox-community/go-netbox v0.0.0-20200916111521-9dc1ea8ff598
1010
github.com/pkg/errors v0.9.1
1111
)

0 commit comments

Comments
 (0)