Skip to content

Commit

Permalink
feat: Add netbox_extras_tag resource
Browse files Browse the repository at this point in the history
  • Loading branch information
amhn committed Nov 18, 2022
1 parent 820a3f1 commit 08a4f8a
Show file tree
Hide file tree
Showing 13 changed files with 456 additions and 68 deletions.
6 changes: 6 additions & 0 deletions examples/resources/netbox_extras_tag/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "netbox_extras_tag" "tag_test" {
name = "Test tag"
slug = "test-tag"
description = "Tag for testing"
color = "00ff00"
}
20 changes: 10 additions & 10 deletions netbox/dcim/resource_netbox_dcim_device_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,24 @@ func TestAccNetboxDcimDeviceRoleMinimalFullMinimal(t *testing.T) {
func testAccCheckNetboxDcimDeviceRoleConfig(nameSuffix string, resourceFull, extraResources bool) string {
template := `
{{ if eq .extraresources "true" }}
#resource "netbox_extras_tag" "test" {
# name = "test-{{ .namesuffix }}"
# slug = "test-{{ .namesuffix }}"
#}
resource "netbox_extras_tag" "test" {
name = "test-{{ .namesuffix }}"
slug = "test-{{ .namesuffix }}"
}
{{ end }}
resource "netbox_dcim_device_role" "test" {
name = "test-{{ .namesuffix }}"
slug = "test-{{ .namesuffix }}"
{{ if eq .resourcefull "true" }}
description = "Test device role"
color = "00ff00"
vm_role = false
color = "00ff00"
vm_role = false
#tag {
# name = netbox_extras_tag.test.name
# slug = netbox_extras_tag.test.slug
#}
tag {
name = netbox_extras_tag.test.name
slug = netbox_extras_tag.test.slug
}
{{ end }}
}
`
Expand Down
16 changes: 8 additions & 8 deletions netbox/dcim/resource_netbox_dcim_manufacturer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ func TestAccNetboxDcimManufacturerMinimalFullMinimal(t *testing.T) {
func testAccCheckNetboxDcimManufacturerConfig(nameSuffix string, resourceFull, extraResources bool) string {
template := `
{{ if eq .extraresources "true" }}
#resource "netbox_extras_tag" "test" {
# name = "test-{{ .namesuffix }}"
# slug = "test-{{ .namesuffix }}"
#}
resource "netbox_extras_tag" "test" {
name = "test-{{ .namesuffix }}"
slug = "test-{{ .namesuffix }}"
}
{{ end }}
resource "netbox_dcim_manufacturer" "test" {
Expand All @@ -105,10 +105,10 @@ func testAccCheckNetboxDcimManufacturerConfig(nameSuffix string, resourceFull, e
{{ if eq .resourcefull "true" }}
description = "Test device role"
#tag {
# name = netbox_extras_tag.test.name
# slug = netbox_extras_tag.test.slug
#}
tag {
name = netbox_extras_tag.test.name
slug = netbox_extras_tag.test.slug
}
{{ end }}
}
`
Expand Down
16 changes: 8 additions & 8 deletions netbox/dcim/resource_netbox_dcim_platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ func testAccCheckNetboxDcimPlatformConfig(nameSuffix string, resourceFull, extra
slug = "test-{{ .namesuffix }}"
}
#resource "netbox_extras_tag" "test" {
# name = "test-{{ .namesuffix }}"
# slug = "test-{{ .namesuffix }}"
#}
resource "netbox_extras_tag" "test" {
name = "test-{{ .namesuffix }}"
slug = "test-{{ .namesuffix }}"
}
{{ end }}
resource "netbox_dcim_platform" "test" {
Expand All @@ -113,10 +113,10 @@ func testAccCheckNetboxDcimPlatformConfig(nameSuffix string, resourceFull, extra
napalm_driver = "test"
napalm_args = "testing"
#tag {
# name = netbox_extras_tag.test.name
# slug = netbox_extras_tag.test.slug
#}
tag {
name = netbox_extras_tag.test.name
slug = netbox_extras_tag.test.slug
}
{{ end }}
}
`
Expand Down
16 changes: 8 additions & 8 deletions netbox/dcim/resource_netbox_dcim_site_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ func testAccCheckNetboxDcimSiteConfig(nameSuffix string, resourceFull, extraReso
rir_id = netbox_ipam_rir.test.id
}
#resource "netbox_extras_tag" "test" {
# name = "test-{{ .namesuffix }}"
# slug = "test-{{ .namesuffix }}"
#}
resource "netbox_extras_tag" "test" {
name = "test-{{ .namesuffix }}"
slug = "test-{{ .namesuffix }}"
}
{{ end }}
resource "netbox_dcim_site" "test" {
Expand Down Expand Up @@ -162,10 +162,10 @@ func testAccCheckNetboxDcimSiteConfig(nameSuffix string, resourceFull, extraReso
netbox_ipam_asn.test.id
]
#tag {
# name = netbox_extras_tag.test.name
# slug = netbox_extras_tag.test.slug
#}
tag {
name = netbox_extras_tag.test.name
slug = netbox_extras_tag.test.slug
}
{{ end }}
}
`
Expand Down
16 changes: 16 additions & 0 deletions netbox/extras/init_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package extras_test

import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/smutel/terraform-provider-netbox/v4/netbox"
)

var testAccProviders map[string]*schema.Provider
var testAccProvider *schema.Provider

func init() {
testAccProvider = netbox.Provider()
testAccProviders = map[string]*schema.Provider{
"netbox": testAccProvider,
}
}
Loading

0 comments on commit 08a4f8a

Please sign in to comment.