Closed amhn closed 1 year ago
I did some tests and I have a strange behavior. I am using the file examples/main.tf.
Without CPU + terraform apply (creation)
=> OK
terraform apply without change
=> OK
Add CPU + terraform apply (update)
=> OK
terraform apply without change
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
-/+ destroy and then create replacement
Terraform will perform the following actions:
-/+ resource "netbox_ipam_ip_addresses" "ip_test" { ~ content_type = "ipam.ipaddresse" -> (known after apply) ~ id = "49" -> (known after apply)
vrf_id = 0 -> null
# (9 unchanged blocks hidden)
}
~ resource "netbox_ipam_service" "service_test" { id = "29" ~ ip_addresses_id = [
49, ] -> (known after apply) name = "SMTP"
}
Yes. This is triggered by https://github.com/smutel/go-netbox/commit/c6308a5357f811ccd0c64aa492d59bb63c4f274e
Any change of the virtual machine sets the primary_ip4 back to null. I noticed this but did not have time to report this yet.
This is unrelated to my changes. A change in the description would trigger the same replacement.
OK, il will try to fix that in my PR for IPv6.
Fixes: #82
Creating a VM without vcpus did not work because the addition of ".00" prevented the latter check for "" from working. This resulted in sending
"vpus": 0
which is not allowed in netbox.Additionally a read of a VM without vcpus failed with a panic because netbox sends null as value for vcpus.
Setting vcpus back to null does not work because of limitations in go-swagger or the json library in go. See the primary_ip issue. This is currently silently ignored in the Update.