Plugin error when adding a second volume to a ionoscloud_server
aimee-889 opened this issue · 3 comments
aimee-889 commented
Description
When I try to add a second volume to my vm (ionoscloud_server) I get an Error.
Expected behavior
I expected the second volume to be added to my vm.
Environment
Terraform version:
Terraform v1.1.4
on linux_amd64
Provider version:
terraform-provider-ionoscloud_v6.1.3
OS:
on linux_amd64
Ubuntu 20.04.3 LTS
## Configuration Files
main.tf
data "ionoscloud_datacenter" "datacenter" {
id = var.datacenter
}
resource "ionoscloud_ipblock" "public_ip" {
name = var.ip_pool_name
location = data.ionoscloud_datacenter.datacenter.location
size = 1
}
resource "ionoscloud_server" "admin_vm_server" {
name = "admin-vm-${terraform.workspace}-server"
datacenter_id = var.datacenter
cores = var.admin_vm_server_cpu
ram = var.admin_vm_server_memory
image_name = "ubuntu"
cpu_family = var.cpu_family
availability_zone = "AUTO"
ssh_key_path = [local.public_key_path]
volume {
# /dev/vda1
name = "main-ssd-${terraform.workspace}"
size = var.admin_vm_volume_size
disk_type = "SSD Standard"
}
nic {
lan = ionoscloud_lan.admin_vm_server_lan.id
dhcp = true
ips = [ionoscloud_ipblock.public_ip.ips[0]]
firewall_active = true
name = "public"
}
}
resource "ionoscloud_lan" "admin_vm_server_lan" {
datacenter_id = var.datacenter
public = true
name = "admin-vm-public"
}
resource "ionoscloud_firewall" "admin_vm_server_ssh" {
datacenter_id = var.datacenter
server_id = ionoscloud_server.admin_vm_server.id
nic_id = ionoscloud_server.admin_vm_server.primary_nic
protocol = "TCP"
name = "SSH"
port_range_start = 22
port_range_end = 22
}
# Extra Volume (throws plugin error)
resource "ionoscloud_volume" "second_volume" {
datacenter_id = var.datacenter
server_id = ionoscloud_server.admin_vm_server.id
name = "second-volume"
#availability_zone = "ZONE_1"
size = 100
disk_type = "SSD Standard"
# VIRTIO OR IDE
bus = "VIRTIO"
image_name = var.image
}
----
variable "datacenter" {
type = string
}
variable "ip_pool_name" {
type = string
description = "Name of the ip pools"
}
variable "admin_vm_server_memory" {
type = number
description = "memory of the admin vm servers"
}
variable "admin_vm_server_cpu" {
type = number
description = "cpu of the admin vm servers"
}
variable "admin_vm_volume_size" {
type = number
description = "volume size for vm"
}
variable "cpu_family" {
type = string
}
variable "image" {
type = string
default = "ubuntu"
}
--------
module "sc-admin-vm" {
source = "./../../modules/sc-ionos-admin-vm/"
datacenter = module.sc_ionos_datacenter.datacenter_id
cpu_family = local.cpu_family
admin_vm_server_memory = local.admin2go_server_memory
admin_vm_server_cpu = local.admin2go_server_cpu
admin_vm_volume_size = local.admin2go_volume_size
image = local.ubuntu_image
ip_pool_name = "somename"
}
-------------
locals {
cpu_family = "INTEL_SKYLAKE"
admin2go_server_memory = 8192
admin2go_server_cpu = 4
admin2go_volume_size = 105
ubuntu_image = "ubuntu:latest"
}
-----------
## How to Reproduce
Steps to reproduce the behavior:
1. Build a VM and try to add a second volume
2. run terraform apply
3. approve with yes
4. Plugin crashed Error message
## Error and Debug Output
**Error: Plugin did not respond**
│
│ with module.sc-admin-vm.ionoscloud_volume.second_volume,
│ on ../../modules/sc-ionos-admin-vm/main.tf line 72, in resource "ionoscloud_volume" "second_volume":
│ 72: resource "ionoscloud_volume" "second_volume" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-ionoscloud_v6.1.3 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xdcab5e]
goroutine 40 [running]:
github.com/ionos-cloud/terraform-provider-ionoscloud/v6/ionoscloud.checkImage({0x11263c8, 0xc00007c840}, 0xc000488820, {0xc0004991b0, 0xc}, {0x0, 0x0}, {0x0, 0x0}, {0xc000040c90, ...}, ...)
github.com/ionos-cloud/terraform-provider-ionoscloud/v6/ionoscloud/resource_volume.go:772 +0x111e
github.com/ionos-cloud/terraform-provider-ionoscloud/v6/ionoscloud.resourceVolumeCreate({0x11263c8, 0xc00007c840}, 0xc0001976c0, {0xeef2e0, 0xc0003ace80})
github.com/ionos-cloud/terraform-provider-ionoscloud/v6/ionoscloud/resource_volume.go:181 +0x38e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc00024b180, {0x1126358, 0xc00024cf40}, 0x2, {0xeef2e0, 0xc0003ace80})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:341 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00024b180, {0x1126358, 0xc00024cf40}, 0xc00017a8f0, 0xc000183880, {0xeef2e0, 0xc0003ace80})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:467 +0x871
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00000d7a0, {0x1126358, 0xc00024cf40}, 0xc0000db900)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000183300, {0x1126400, 0xc0002ae840}, 0xc000504e70)
github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:603 +0x30e
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xf771a0, 0xc000183300}, {0x1126400, 0xc0002ae840}, 0xc00009d980, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000221340, {0x1135050, 0xc000158a80}, 0xc000484400, 0xc0003b8e40, 0x17e9340, 0x0)
google.golang.org/grpc@v1.32.0/server.go:1194 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc000221340, {0x1135050, 0xc000158a80}, 0xc000484400, 0x0)
google.golang.org/grpc@v1.32.0/server.go:1517 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/grpc@v1.32.0/server.go:859 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.32.0/server.go:857 +0x294
Error: The terraform-provider-ionoscloud_v6.1.3 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
## Additional Notes
## References
cristiGuranIonos commented
Thanks for raising this! We will have a fix as soon as possible.
cristiGuranIonos commented
Meanwhile as a workaround, try setting image_password or ssh_key_path on 'second_volume'.
cristiGuranIonos commented
Fixed in v6.2.3