diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index e9f7a8cb..729773cd 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -33,17 +33,9 @@ jobs: fail-fast: false matrix: netbox-version: - # - v4.0.0 has mandatory tenant group - - v4.0.1 - - v4.0.2 - - v4.0.3 - # - v4.0.4 does not exist for some reason - - v4.0.5 - - v4.0.6 - - v4.0.7 - - v4.0.8 - - v4.0.9 - - v4.0.10 + - v4.1.0 + - v4.1.1 + - v4.1.2 steps: - uses: actions/checkout@v4 - name: Set up Go diff --git a/GNUmakefile b/GNUmakefile index 8b0e36cd..4db5ec4b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ TEST_FUNC?=TestAccNetboxEventRule_basic GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) DOCKER_COMPOSE=docker compose -export NETBOX_VERSION=v4.0.10 +export NETBOX_VERSION=v4.1.2 export NETBOX_SERVER_URL=http://localhost:8001 export NETBOX_API_TOKEN=0123456789abcdef0123456789abcdef01234567 export NETBOX_TOKEN=$(NETBOX_API_TOKEN) diff --git a/README.md b/README.md index 27489531..304aaa58 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ Since version [1.6.6](https://github.com/e-breuninger/terraform-provider-netbox/ | Netbox version | Provider version | | --------------- | ---------------- | -| v4.0.0 - 4.0.10 | v3.9.0 and up | +| v4.1.0 - 4.1.2 | v3.10.0 and up | +| v4.0.0 - 4.0.10 | v3.9.0 - 3.9.1 | | v3.7.0 - 3.7.8 | v3.8.0 - 3.8.9 | | v3.6.0 - 3.6.9 | v3.7.0 - 3.7.7 | | v3.5.1 - 3.5.9 | v3.6.x | diff --git a/netbox/data_source_netbox_virtual_machines.go b/netbox/data_source_netbox_virtual_machines.go index 7b84e84b..2180164d 100644 --- a/netbox/data_source_netbox_virtual_machines.go +++ b/netbox/data_source_netbox_virtual_machines.go @@ -244,7 +244,7 @@ func dataSourceNetboxVirtualMachineRead(d *schema.ResourceData, m interface{}) e mapping["custom_fields"] = v.CustomFields } if v.Disk != nil { - mapping["disk_size_gb"] = *v.Disk + mapping["disk_size_gb"] = *v.Disk / 1000 } if v.LocalContextData != nil { if localContextData, err := json.Marshal(v.LocalContextData); err == nil { diff --git a/netbox/provider.go b/netbox/provider.go index 7e83144c..bd909cfe 100644 --- a/netbox/provider.go +++ b/netbox/provider.go @@ -295,7 +295,7 @@ func providerConfigure(ctx context.Context, data *schema.ResourceData) (interfac netboxVersion := res.GetPayload().(map[string]interface{})["netbox-version"].(string) - supportedVersions := []string{"4.0.0", "4.0.1", "4.0.2", "4.0.3", "4.0.5", "4.0.6", "4.0.7", "4.0.8", "4.0.9", "4.0.10"} + supportedVersions := []string{"4.1.0", "4.1.1", "4.1.2"} if !slices.Contains(supportedVersions, netboxVersion) { // Currently, there is no way to test these warnings. There is an issue to track this: https://github.com/hashicorp/terraform-plugin-sdk/issues/864 diff --git a/netbox/resource_netbox_virtual_machine.go b/netbox/resource_netbox_virtual_machine.go index 2d1ae4c7..faa65707 100644 --- a/netbox/resource_netbox_virtual_machine.go +++ b/netbox/resource_netbox_virtual_machine.go @@ -153,7 +153,7 @@ func resourceNetboxVirtualMachineCreate(ctx context.Context, d *schema.ResourceD diskSizeValue, ok := d.GetOk("disk_size_gb") if ok { - diskSize := int64(diskSizeValue.(int)) + diskSize := int64(diskSizeValue.(int)) * 1000 data.Disk = &diskSize } @@ -308,7 +308,10 @@ func resourceNetboxVirtualMachineRead(ctx context.Context, d *schema.ResourceDat d.Set("vcpus", nil) } d.Set("memory_mb", vm.Memory) - d.Set("disk_size_gb", vm.Disk) + if vm.Disk != nil { + diskSizeGb := *vm.Disk / 1000 + d.Set("disk_size_gb", diskSizeGb) + } if vm.Status != nil { d.Set("status", vm.Status.Value) } else { diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index cd7908b3..1087cc63 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -16,7 +16,8 @@ Netbox often makes breaking API changes even in non-major releases. Check the ta | Netbox version | Provider version | | --------------- | ---------------- | -| v4.0.0 - 4.0.10 | v3.9.0 and up | +| v4.1.0 - 4.1.2 | v3.10.0 and up | +| v4.0.0 - 4.0.10 | v3.9.0 - 3.9.1 | | v3.7.0 - 3.7.8 | v3.8.0 - 3.8.9 | | v3.6.0 - 3.6.9 | v3.7.0 - 3.7.7 | | v3.5.1 - 3.5.9 | v3.6.x |