Skip to content

Commit

Permalink
feat: Update to work with Netbox 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Jan 12, 2023
1 parent 066d43e commit bbd12f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "netbox_dcim_device_role" "device_role_test" {
name = "Test device role"
slug = "Test device role"
slug = "Test_device_role"
description = "Device role for testing"
color = "00ff00"
}
Expand Down Expand Up @@ -320,7 +320,7 @@ resource "netbox_ipam_prefix" "dynamic_prefix_test" {
parent_prefix {
prefix = netbox_ipam_prefix.prefix_test.id
prefix_length = 26
}
}
description = "Dynamic prefix created by terraform"
}

Expand Down
3 changes: 1 addition & 2 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
terraform {
required_version = ">= 0.14.0"
required_providers {
netbox = {
source = "smutel/netbox"
version = "~> 4.0.0"
version = "~> 6.0.0"
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions netbox/dcim/resource_netbox_dcim_site.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ func resourceNetboxDcimSiteCreate(ctx context.Context, d *schema.ResourceData,
Slug: &slug,
Status: d.Get("status").(string),
Tags: tag.ConvertTagsToNestedTags(tags),
TimeZone: d.Get("time_zone").(string),
}

if groupID != 0 {
Expand All @@ -225,6 +224,9 @@ func resourceNetboxDcimSiteCreate(ctx context.Context, d *schema.ResourceData,
if tenantID != 0 {
newResource.Tenant = &tenantID
}
if timezone := d.Get("time_zone").(string); timezone != "" {
newResource.TimeZone = &timezone
}

resource := dcim.NewDcimSitesCreateParams().WithData(newResource)

Expand Down Expand Up @@ -431,7 +433,7 @@ func resourceNetboxDcimSiteUpdate(ctx context.Context, d *schema.ResourceData,
}
if d.HasChange("time_zone") {
timeZone := d.Get("time_zone").(string)
params.TimeZone = timeZone
params.TimeZone = &timeZone
modifiedFields["time_zone"] = timeZone
}

Expand Down

0 comments on commit bbd12f1

Please sign in to comment.