From 08a4f8a3ea0115454870d4dde04773701817ecb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Nie=C3=9F?= Date: Sun, 30 Oct 2022 21:02:16 +0100 Subject: [PATCH] feat: Add netbox_extras_tag resource --- .../resources/netbox_extras_tag/resource.tf | 6 + .../resource_netbox_dcim_device_role_test.go | 20 +- .../resource_netbox_dcim_manufacturer_test.go | 16 +- .../resource_netbox_dcim_platform_test.go | 16 +- netbox/dcim/resource_netbox_dcim_site_test.go | 16 +- netbox/extras/init_test.go | 16 ++ netbox/extras/resource_netbox_extras_tag.go | 258 ++++++++++++++++++ .../extras/resource_netbox_extras_tag_test.go | 110 ++++++++ .../resource_netbox_ipam_aggregate_test.go | 16 +- netbox/ipam/resource_netbox_ipam_asn_test.go | 16 +- netbox/ipam/resource_netbox_ipam_rir_test.go | 16 +- netbox/provider.go | 2 + .../resource_netbox_virtualization_vm_test.go | 16 +- 13 files changed, 456 insertions(+), 68 deletions(-) create mode 100644 examples/resources/netbox_extras_tag/resource.tf create mode 100644 netbox/extras/init_test.go create mode 100644 netbox/extras/resource_netbox_extras_tag.go create mode 100644 netbox/extras/resource_netbox_extras_tag_test.go diff --git a/examples/resources/netbox_extras_tag/resource.tf b/examples/resources/netbox_extras_tag/resource.tf new file mode 100644 index 000000000..d2cabda53 --- /dev/null +++ b/examples/resources/netbox_extras_tag/resource.tf @@ -0,0 +1,6 @@ +resource "netbox_extras_tag" "tag_test" { + name = "Test tag" + slug = "test-tag" + description = "Tag for testing" + color = "00ff00" +} diff --git a/netbox/dcim/resource_netbox_dcim_device_role_test.go b/netbox/dcim/resource_netbox_dcim_device_role_test.go index 849bb4e52..e7b69ce71 100644 --- a/netbox/dcim/resource_netbox_dcim_device_role_test.go +++ b/netbox/dcim/resource_netbox_dcim_device_role_test.go @@ -93,10 +93,10 @@ 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" { @@ -104,13 +104,13 @@ func testAccCheckNetboxDcimDeviceRoleConfig(nameSuffix string, resourceFull, ext 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 }} } ` diff --git a/netbox/dcim/resource_netbox_dcim_manufacturer_test.go b/netbox/dcim/resource_netbox_dcim_manufacturer_test.go index 6c0efb063..25bc4a6c7 100644 --- a/netbox/dcim/resource_netbox_dcim_manufacturer_test.go +++ b/netbox/dcim/resource_netbox_dcim_manufacturer_test.go @@ -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" { @@ -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 }} } ` diff --git a/netbox/dcim/resource_netbox_dcim_platform_test.go b/netbox/dcim/resource_netbox_dcim_platform_test.go index 07781b3c3..61406e660 100644 --- a/netbox/dcim/resource_netbox_dcim_platform_test.go +++ b/netbox/dcim/resource_netbox_dcim_platform_test.go @@ -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" { @@ -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 }} } ` diff --git a/netbox/dcim/resource_netbox_dcim_site_test.go b/netbox/dcim/resource_netbox_dcim_site_test.go index 50d4ae779..e64a222f2 100644 --- a/netbox/dcim/resource_netbox_dcim_site_test.go +++ b/netbox/dcim/resource_netbox_dcim_site_test.go @@ -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" { @@ -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 }} } ` diff --git a/netbox/extras/init_test.go b/netbox/extras/init_test.go new file mode 100644 index 000000000..6f5e4e382 --- /dev/null +++ b/netbox/extras/init_test.go @@ -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, + } +} diff --git a/netbox/extras/resource_netbox_extras_tag.go b/netbox/extras/resource_netbox_extras_tag.go new file mode 100644 index 000000000..dc1cc7953 --- /dev/null +++ b/netbox/extras/resource_netbox_extras_tag.go @@ -0,0 +1,258 @@ +package extras + +import ( + "context" + "regexp" + "strconv" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + netboxclient "github.com/smutel/go-netbox/v3/netbox/client" + "github.com/smutel/go-netbox/v3/netbox/client/extras" + "github.com/smutel/go-netbox/v3/netbox/models" + "github.com/smutel/terraform-provider-netbox/v4/netbox/internal/requestmodifier" + "github.com/smutel/terraform-provider-netbox/v4/netbox/internal/util" +) + +func ResourceNetboxExtrasTag() *schema.Resource { + return &schema.Resource{ + Description: "Manage a tag (extra module) within Netbox.", + CreateContext: resourceNetboxExtrasTagCreate, + ReadContext: resourceNetboxExtrasTagRead, + UpdateContext: resourceNetboxExtrasTagUpdate, + DeleteContext: resourceNetboxExtrasTagDelete, + Exists: resourceNetboxExtrasTagExists, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + + Schema: map[string]*schema.Schema{ + "content_type": { + Type: schema.TypeString, + Computed: true, + Description: "The content type of this tag (extra module).", + }, + "color": { + Type: schema.TypeString, + Optional: true, + Default: "9e9e9e", + ValidateFunc: validation.All( + validation.StringLenBetween(1, 6), + validation.StringMatch( + regexp.MustCompile("^[0-9a-f]{1,6}$"), + "^[0-9a-f]{1,6})$")), + Description: "The color of this tag. Default is grey (#9e9e9e).", + }, + "created": { + Type: schema.TypeString, + Computed: true, + Description: "Date when this tag was created.", + }, + "description": { + Type: schema.TypeString, + Optional: true, + Default: nil, + ValidateFunc: validation.StringLenBetween(1, 200), + Description: "The description of this tag.", + }, + "last_updated": { + Type: schema.TypeString, + Computed: true, + Description: "Date when this tag was last updated.", + }, + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 100), + Description: "The name of this tag.", + }, + "slug": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringLenBetween(1, 100), + Description: "The slug of this tag.", + }, + "tagged_items": { + Type: schema.TypeInt, + Computed: true, + Description: "The number of items tagged with this tag.", + }, + "url": { + Type: schema.TypeString, + Computed: true, + Description: "The link to this tag.", + }, + }, + } +} + +var tagRequiredFields = []string{ + "created", + "last_updated", + "name", + "slug", +} + +func resourceNetboxExtrasTagCreate(ctx context.Context, d *schema.ResourceData, + m interface{}) diag.Diagnostics { + client := m.(*netboxclient.NetBoxAPI) + + name := d.Get("name").(string) + slug := d.Get("slug").(string) + + newResource := &models.Tag{ + Name: &name, + Slug: &slug, + Description: d.Get("description").(string), + Color: d.Get("color").(string), + } + + resource := extras.NewExtrasTagsCreateParams().WithData(newResource) + + resourceCreated, err := client.Extras.ExtrasTagsCreate(resource, nil) + if err != nil { + return diag.FromErr(err) + } + + d.SetId(strconv.FormatInt(resourceCreated.Payload.ID, 10)) + + return resourceNetboxExtrasTagRead(ctx, d, m) +} + +func resourceNetboxExtrasTagRead(ctx context.Context, d *schema.ResourceData, + m interface{}) diag.Diagnostics { + client := m.(*netboxclient.NetBoxAPI) + + resourceID := d.Id() + params := extras.NewExtrasTagsListParams().WithID(&resourceID) + resources, err := client.Extras.ExtrasTagsList(params, nil) + if err != nil { + return diag.FromErr(err) + } + + if len(resources.Payload.Results) != 1 { + d.SetId("") + return nil + } + + resource := resources.Payload.Results[0] + + if err = d.Set("content_type", util.ConvertURIContentType(resource.URL)); err != nil { + return diag.FromErr(err) + } + + if err = d.Set("color", resource.Color); err != nil { + return diag.FromErr(err) + } + if err = d.Set("created", resource.Created.String()); err != nil { + return diag.FromErr(err) + } + if err = d.Set("description", resource.Description); err != nil { + return diag.FromErr(err) + } + if err = d.Set("last_updated", resource.LastUpdated.String()); err != nil { + return diag.FromErr(err) + } + if err = d.Set("name", resource.Name); err != nil { + return diag.FromErr(err) + } + if err = d.Set("slug", resource.Slug); err != nil { + return diag.FromErr(err) + } + if err = d.Set("tagged_items", resource.TaggedItems); err != nil { + return diag.FromErr(err) + } + if err = d.Set("url", resource.URL); err != nil { + return diag.FromErr(err) + } + + return nil +} + +func resourceNetboxExtrasTagUpdate(ctx context.Context, d *schema.ResourceData, + m interface{}) diag.Diagnostics { + client := m.(*netboxclient.NetBoxAPI) + modifiedFields := make(map[string]interface{}) + + resourceID, err := strconv.ParseInt(d.Id(), 10, 64) + if err != nil { + return diag.Errorf("Unable to convert ID into int64") + } + + params := &models.Tag{} + + if d.HasChange("color") { + params.Color = d.Get("color").(string) + } + if d.HasChange("description") { + params.Description = d.Get("description").(string) + modifiedFields["description"] = params.Description + } + if d.HasChange("name") { + name := d.Get("name").(string) + params.Name = &name + } + if d.HasChange("slug") { + slug := d.Get("slug").(string) + params.Slug = &slug + } + + resource := extras.NewExtrasTagsPartialUpdateParams().WithData(params) + + resource.SetID(resourceID) + + _, err = client.Extras.ExtrasTagsPartialUpdate(resource, nil, requestmodifier.NewNetboxRequestModifier(modifiedFields, tagRequiredFields)) + if err != nil { + return diag.FromErr(err) + } + + return resourceNetboxExtrasTagRead(ctx, d, m) +} + +func resourceNetboxExtrasTagDelete(ctx context.Context, d *schema.ResourceData, + m interface{}) diag.Diagnostics { + client := m.(*netboxclient.NetBoxAPI) + + resourceExists, err := resourceNetboxExtrasTagExists(d, m) + if err != nil { + return diag.FromErr(err) + } + + if !resourceExists { + return nil + } + + id, err := strconv.ParseInt(d.Id(), 10, 64) + if err != nil { + return diag.Errorf("Unable to convert ID into int64") + } + + resource := extras.NewExtrasTagsDeleteParams().WithID(id) + if _, err := client.Extras.ExtrasTagsDelete(resource, nil); err != nil { + return diag.FromErr(err) + } + + return nil +} + +func resourceNetboxExtrasTagExists(d *schema.ResourceData, + m interface{}) (b bool, e error) { + client := m.(*netboxclient.NetBoxAPI) + resourceExist := false + + resourceID := d.Id() + params := extras.NewExtrasTagsListParams().WithID(&resourceID) + resources, err := client.Extras.ExtrasTagsList(params, nil) + if err != nil { + return resourceExist, err + } + + for _, resource := range resources.Payload.Results { + if strconv.FormatInt(resource.ID, 10) == d.Id() { + resourceExist = true + } + } + + return resourceExist, nil +} diff --git a/netbox/extras/resource_netbox_extras_tag_test.go b/netbox/extras/resource_netbox_extras_tag_test.go new file mode 100644 index 000000000..6e372edbe --- /dev/null +++ b/netbox/extras/resource_netbox_extras_tag_test.go @@ -0,0 +1,110 @@ +package extras_test + +import ( + "strconv" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/smutel/terraform-provider-netbox/v4/netbox/internal/util" +) + +const resourceNameNetboxExtrasTag = "netbox_extras_tag.test" + +func TestAccNetboxExtrasTagMinimal(t *testing.T) { + nameSuffix := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { util.TestAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckNetboxExtrasTagConfig(nameSuffix, false, false), + Check: resource.ComposeTestCheckFunc( + util.TestAccResourceExists(resourceNameNetboxExtrasTag), + ), + }, + { + ResourceName: resourceNameNetboxExtrasTag, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccNetboxExtrasTagFull(t *testing.T) { + nameSuffix := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { util.TestAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckNetboxExtrasTagConfig(nameSuffix, true, true), + Check: resource.ComposeTestCheckFunc( + util.TestAccResourceExists(resourceNameNetboxExtrasTag), + ), + }, + { + ResourceName: resourceNameNetboxExtrasTag, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccNetboxExtrasTagMinimalFullMinimal(t *testing.T) { + nameSuffix := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { util.TestAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckNetboxExtrasTagConfig(nameSuffix, false, false), + Check: resource.ComposeTestCheckFunc( + util.TestAccResourceExists(resourceNameNetboxExtrasTag), + ), + }, + { + Config: testAccCheckNetboxExtrasTagConfig(nameSuffix, true, true), + Check: resource.ComposeTestCheckFunc( + util.TestAccResourceExists(resourceNameNetboxExtrasTag), + ), + }, + { + Config: testAccCheckNetboxExtrasTagConfig(nameSuffix, false, true), + Check: resource.ComposeTestCheckFunc( + util.TestAccResourceExists(resourceNameNetboxExtrasTag), + ), + }, + { + Config: testAccCheckNetboxExtrasTagConfig(nameSuffix, false, false), + Check: resource.ComposeTestCheckFunc( + util.TestAccResourceExists(resourceNameNetboxExtrasTag), + ), + }, + }, + }) +} + +func testAccCheckNetboxExtrasTagConfig(nameSuffix string, resourceFull, extraResources bool) string { + template := ` + resource "netbox_extras_tag" "test" { + name = "test-{{ .namesuffix }}" + slug = "test-{{ .namesuffix }}" + {{ if eq .resourcefull "true" }} + description = "Test tag" + color = "00ff00" + {{ end }} + } + ` + data := map[string]string{ + "namesuffix": nameSuffix, + "resourcefull": strconv.FormatBool(resourceFull), + "extraresources": strconv.FormatBool(extraResources), + } + return util.RenderTemplate(template, data) +} diff --git a/netbox/ipam/resource_netbox_ipam_aggregate_test.go b/netbox/ipam/resource_netbox_ipam_aggregate_test.go index 8b46c6601..64e0ec676 100644 --- a/netbox/ipam/resource_netbox_ipam_aggregate_test.go +++ b/netbox/ipam/resource_netbox_ipam_aggregate_test.go @@ -101,10 +101,10 @@ func testAccCheckNetboxIPAMAggregateConfig(nameSuffix string, resourceFull, extr } {{ 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 }}" + } resource "netbox_tenancy_tenant" "test" { name = "test-{{ .namesuffix }}" @@ -120,10 +120,10 @@ func testAccCheckNetboxIPAMAggregateConfig(nameSuffix string, resourceFull, extr tenant_id = netbox_tenancy_tenant.test.id date_added = "1971-01-02" description = "Test Aggregate" - #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 }} } ` diff --git a/netbox/ipam/resource_netbox_ipam_asn_test.go b/netbox/ipam/resource_netbox_ipam_asn_test.go index df2d982a4..e98c1e025 100644 --- a/netbox/ipam/resource_netbox_ipam_asn_test.go +++ b/netbox/ipam/resource_netbox_ipam_asn_test.go @@ -106,10 +106,10 @@ func testAccCheckNetboxIpamAsnConfig(nameSuffix string, resourceFull, extraResou 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_ipam_asn" "test" { @@ -119,10 +119,10 @@ func testAccCheckNetboxIpamAsnConfig(nameSuffix string, resourceFull, extraResou description = "Test ASN" tenant_id = netbox_tenancy_tenant.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 }} } ` diff --git a/netbox/ipam/resource_netbox_ipam_rir_test.go b/netbox/ipam/resource_netbox_ipam_rir_test.go index 74f2719df..00ac02188 100644 --- a/netbox/ipam/resource_netbox_ipam_rir_test.go +++ b/netbox/ipam/resource_netbox_ipam_rir_test.go @@ -94,10 +94,10 @@ func TestAccNetboxIpamRIRMininmalFullMinimal(t *testing.T) { func testAccCheckNetboxIPAMRIRConfig(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_ipam_rir" "test" { @@ -107,10 +107,10 @@ func testAccCheckNetboxIPAMRIRConfig(nameSuffix string, resourceFull, extraResou description = "Test RIR" is_private = true - #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 }} } ` diff --git a/netbox/provider.go b/netbox/provider.go index fdc188493..87bdcceaf 100644 --- a/netbox/provider.go +++ b/netbox/provider.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/smutel/go-netbox/v3/netbox/client" "github.com/smutel/terraform-provider-netbox/v4/netbox/dcim" + "github.com/smutel/terraform-provider-netbox/v4/netbox/extras" "github.com/smutel/terraform-provider-netbox/v4/netbox/ipam" "github.com/smutel/terraform-provider-netbox/v4/netbox/json" "github.com/smutel/terraform-provider-netbox/v4/netbox/tenancy" @@ -165,6 +166,7 @@ func Provider() *schema.Provider { "netbox_dcim_device_role": dcim.ResourceNetboxDcimDeviceRole(), "netbox_dcim_platform": dcim.ResourceNetboxDcimPlatform(), "netbox_dcim_site": dcim.ResourceNetboxDcimSite(), + "netbox_extras_tag": extras.ResourceNetboxExtrasTag(), "netbox_ipam_aggregate": ipam.ResourceNetboxIpamAggregate(), "netbox_ipam_asn": ipam.ResourceNetboxIpamASN(), "netbox_ipam_ip_addresses": ipam.ResourceNetboxIpamIPAddresses(), diff --git a/netbox/virtualization/resource_netbox_virtualization_vm_test.go b/netbox/virtualization/resource_netbox_virtualization_vm_test.go index 1b3075685..a1c5815ba 100644 --- a/netbox/virtualization/resource_netbox_virtualization_vm_test.go +++ b/netbox/virtualization/resource_netbox_virtualization_vm_test.go @@ -116,10 +116,10 @@ func testAccCheckNetboxVirtualizationVMConfig(nameSuffix string, resourceFull, e 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 }}" + } resource "netbox_tenancy_tenant" "test" { name = "test-{{ .namesuffix }}" @@ -149,13 +149,9 @@ func testAccCheckNetboxVirtualizationVMConfig(nameSuffix string, resourceFull, e } ) - #tag { - # name = netbox_extras_tag.test.name - # slug = netbox_extras_tag.test.slug - #} tag { - name = "tag1" - slug = "tag1" + name = netbox_extras_tag.test.name + slug = netbox_extras_tag.test.slug } {{ end }} }