Describe the bug
When trying to create a virtual machine without specifying any network, the creation fails with the following output:
mgc_virtual_machine_instances.demo: Creating...
╷
│ Error: Value Conversion Error
│
│ with mgc_virtual_machine_instances.demo,
│ on main.tf line 13, in resource "mgc_virtual_machine_instances" "demo":
│ 13: resource "mgc_virtual_machine_instances" "demo" {
│
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│
│ Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that
│ handles null values.
│
│ Path: network
│ Target Type: resources.networkVmInstancesModel
│ Suggested `types` Type: basetypes.ObjectValue
│ Suggested Pointer Type: *resources.networkVmInstancesModel
╵
However, the virtual machine is created successfully after adding the network section in the resource definition.
To Reproduce
Apply the following main.tf file using terraform apply:
Since the network attribute is specified as optional in the provider documentation, I'd expect the creation of the virtual machine to work without specifying it.
Desktop (please complete the following information):
OS: Fedora 40
Terraform: v1.9.5
MGC Provider: v0.24.5
MGC CLI: v0.25.0 (linux/amd64)
Additional information
Full terraform apply output:
❯ terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# mgc_virtual_machine_instances.demo will be created
+ resource "mgc_virtual_machine_instances" "demo" {
+ created_at = (known after apply)
+ final_name = (known after apply)
+ id = (known after apply)
+ image = {
+ id = (known after apply)
+ name = "cloud-ubuntu-24.04 LTS"
}
+ machine_type = {
+ disk = (known after apply)
+ id = (known after apply)
+ name = "BV1-2-20"
+ ram = (known after apply)
+ vcpus = (known after apply)
}
+ name = "demo"
+ name_is_prefix = false
+ ssh_key_name = "thinkpad"
+ state = (known after apply)
+ status = (known after apply)
+ updated_at = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
mgc_virtual_machine_instances.demo: Creating...
╷
│ Error: Value Conversion Error
│
│ with mgc_virtual_machine_instances.demo,
│ on main.tf line 13, in resource "mgc_virtual_machine_instances" "demo":
│ 13: resource "mgc_virtual_machine_instances" "demo" {
│
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│
│ Received null value, however the target type cannot handle null values. Use the corresponding `types` package type, a pointer type or a custom type that
│ handles null values.
│
│ Path: network
│ Target Type: resources.networkVmInstancesModel
│ Suggested `types` Type: basetypes.ObjectValue
│ Suggested Pointer Type: *resources.networkVmInstancesModel
╵
Describe the bug When trying to create a virtual machine without specifying any
network
, the creation fails with the following output:However, the virtual machine is created successfully after adding the
network
section in the resource definition.To Reproduce
Apply the following
main.tf
file usingterraform apply
:Expected behavior
Since the
network
attribute is specified as optional in the provider documentation, I'd expect the creation of the virtual machine to work without specifying it.Desktop (please complete the following information):
Additional information Full
terraform apply
output: