diff --git a/examples/main.tf b/examples/main.tf index 824ab6bd0..d530104eb 100644 --- a/examples/main.tf +++ b/examples/main.tf @@ -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" } @@ -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" } diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index b9c350dec..f590ad9d9 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,9 +1,8 @@ terraform { - required_version = ">= 0.14.0" required_providers { netbox = { source = "smutel/netbox" - version = "~> 4.0.0" + version = "~> 6.0.0" } } } diff --git a/netbox/dcim/resource_netbox_dcim_site.go b/netbox/dcim/resource_netbox_dcim_site.go index bf2211e19..0a0e65dc4 100644 --- a/netbox/dcim/resource_netbox_dcim_site.go +++ b/netbox/dcim/resource_netbox_dcim_site.go @@ -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 { @@ -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) @@ -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 }