OpenNebula / terraform-provider-opennebula

Terraform provider for OpenNebula
https://www.terraform.io/docs/providers/opennebula/
Mozilla Public License 2.0
63 stars 52 forks source link

Import of opennebula_virtual_network_address_range always fails #456

Closed philipfreude closed 1 year ago

philipfreude commented 1 year ago

Description

Importing the opennebula_virtual_network_address_range always fails with an error message similar to the following one

> terraform import opennebula_virtual_network_address_range.example 15:0
Acquiring state lock. This may take a few moments...
opennebula_virtual_network_address_range.example: Importing from ID "15:0"...
opennebula_virtual_network_address_range.example: Import prepared!
  Prepared opennebula_virtual_network_address_range for import
opennebula_virtual_network_address_range.example: Refreshing state... [id=0]
╷
│ Error: OpenNebula error [NO_EXISTS]: [one.vn.info] Error getting virtual network [0].
│
│
╵

Regardless of the provided vnet_id:ar_id the error always indicates that the provider in unable to find the virtual network with id 0.

The reason is most likely a incorrect key in the resourceOpennebulaVirtualNetworkAddressRangeImportState function. When setting the virtual network id the key vnet_id is used but it should be virtual_network_id.

I will create a merge request shortly.

Terraform and Provider version

Terraform v1.4.6 on darwin_amd64

Affected resources and data sources

opennebula_virtual_network_address_range

Terraform configuration

No response

Expected behavior

The terraform import runs successful.

Actual behavior

The terraform import results in the error above.

Steps to Reproduce

Import any opennebula_virtual_network_address_range.

Debug output

No response

Panic output

No response

Important factoids

No response

References

No response

treywelsh commented 1 year ago

at first I added the issue to the next planned released which was 1.3.0, but there some more bugs now so why not a 1.2.2 if @frousselet is ok when he's back