unableto create empty volume
is2admin opened this issue · 18 comments
Description
im unable to create an empty volume - unlike in the dcd i have to name
'image_name', 'licence_type', or 'image_alias' must be set
i just want to create additional empty drives with hosts easy in dcd but with terraform that seems not possible
Expected behavior
create empty volume
Environment
Terraform version:
Terraform v1.3.1
Provider version:
version = "6.3.2"
OS:
ubuntu
Configuration Files
How to Reproduce
Error and Debug Output
Terraform supports creating attached volumes. This is why it also requires server_id. Maybe you can try using ansible for this meanwhile? https://github.com/ionos-cloud/module-ansible/blob/master/docs/api/compute-engine/volume.md
I know that and i am able to create a volume.
server_id is no problem but i must name an image, but why ?
Doesn't make any sense to add another volume with ubuntu on it - i want a volume thats without os that i can use for app storage/logs etc.
With DCD this is an easy task - but it seems impossible with terraform.
Thx for the tip with ansible module but this is not an option.
You can try to set licence_type to "Unknown", see if that helps.
Usually licence_type is required. But if if an image_name or image_alias is provided the licence_type is already configured at the image and will be used instead. In that case the licence_type can be omitted.
Besides "UNKNOWN" you can also use "OTHER" as value.
ok i tested adding a volume with
resource "ionoscloud_volume" "example" {
datacenter_id = var.datacenter_id
server_id = ionoscloud_server.host.id
name = "Volume Example"
availability_zone = var.availability_zone
size = "100"
disk_type = var.disk_type
licence_type = "OTHER"
ssh_key_path = [var.public_key_file]
image_password = random_string.root_password.result
}
Does not work (same with 'licence_type = "UNKNOWN"')
'''
│ Error: an error occured while creating a volume: 500 Internal Server Error {
│ "httpStatus" : 500,
│ "messages" : [ {
│ "errorCode" : "301",
│ "message" : "Oops! Something went very wrong. Please contact the administrator"
│ } ]
│ }
'''
Hello, we will take a look and then will inform you when we'll have a solution.
There was a backend maintenance and that might have cauised the 500 err response. Would it be possible to try again and let us know if it reproduces? Thanks!
Hello, I managed to reproduce the behavior for the volume. We opened a issue too because it's an api error, but if you want to create a empty volume, you can remove the ssh_key_path for the moment.
For me worked like this:
resource "ionoscloud_volume" "example" {
datacenter_id = ionoscloud_datacenter.example.id
server_id = ionoscloud_server.example.id
name = "Volume Example"
availability_zone = "AUTO"
size = "100"
disk_type = "HDD"
licence_type = "OTHER"
}
We'll lelt you know when the pronlem with ssh_key_path will be solved and thank you for let us know.
│ Error: an error occured while creating a volume: 422 Unprocessable Entity { │ "httpStatus" : 422, │ "messages" : [ { │ "errorCode" : "100", │ "message" : "[(root).properties.imagePassword] Attribute 'image' or 'imageAlias' must be set for password" │ } ] │ }
nope unfortunately also not working...
hello, this is the error for the plan that I provided above? I am asking, because with that example I was not able to reproduce this error, but looking to the error, I think you have the user_data field set in terraform plan, which force you to provide either image or image_alias field.
hello, this is the error for the plan that I provided above?
yap, correct
but you have the user_data field set in terraform plan? Normally this field will trigger this error. If you want to use user_data field, you need to provide either a public image or image_alias. if not it will return an the api error from above
negative, no "user_data" field set
datacenter_id = var.datacenter_id
server_id = ionoscloud_server.host.id
name = "Volume Example"
availability_zone = var.availability_zone
size = "33"
disk_type = var.disk_type
licence_type = "UNKNOWN"
#ssh_key_path = [var.public_key_file]
#image_password = random_string.root_password.result
}```
can you please attach the server too to a message here be more easy to reproduce?
server ressource
resource "ionoscloud_server" "host" {
name = var.name
datacenter_id = var.datacenter_id
cores = var.cpu_core
ram = var.ram * 1024
availability_zone = var.availability_zone
cpu_family = var.cpu_family
image_name = var.image_name
image_password = random_string.root_password.result
#Will be renamed to ssk_keys in the future, to allow users to set both the ssh key path or directly the ssh key
ssh_key_path = [var.public_key_file]
type = var.type
volume {
name = "system"
size = var.disk_size
disk_type = var.disk_type
}
nic {
lan = var.datacenter_lan_id
name = "${var.name}-lan"
dhcp = true
firewall_active = var.firewall_active
#default 'inbound'
#firewall_type = "BIDIRECTIONAL"
#ips = [ ionoscloud_ipblock.example.ips[0], ionoscloud_ipblock.example.ips[1] ]
ips = var.ip_adresses
}
lifecycle {
#nic makes trouble on reapply otherwise
ignore_changes = [availability_zone, nic]
}
}
Thank you, I'll try to reproduce and come with some updates
I could't managed to reproduce the error with the tf plan that you provided, so here is a working example:
resource "ionoscloud_server" "host" {
name = "Server Example"
datacenter_id = ionoscloud_datacenter.example.id
cores = 1
ram = 1024
availability_zone = "ZONE_1"
cpu_family = "AMD_OPTERON"
image_name = "ubuntu-22.04-server-cloudimg-amd64-20220902"
image_password = "aPassword"
#Will be renamed to ssk_keys in the future, to allow users to set both the ssh key path or directly the ssh key
ssh_key_path = ["path/to/public/rsa/key"]
type = "ENTERPRISE"
volume {
name = "system"
size = "100"
disk_type = "HDD"
}
nic {
lan = ionoscloud_lan.example.id
name = "system nic"
dhcp = true
firewall_type = "BIDIRECTIONAL"
#default 'inbound'
#firewall_type = "BIDIRECTIONAL"
ips = [ ionoscloud_ipblock.example.ips[0], ionoscloud_ipblock.example.ips[1] ]
#ips = var.ip_adresses
}
lifecycle {
#nic makes trouble on reapply otherwise
ignore_changes = [availability_zone, nic]
}
}
maybe there is a variable value which trigger this error, so if you want, you can provide the values for vars, except sensitive data, of course to try to use them and see if I can get 422 error.
Hello, again, we found a case for the error, if you provide a licence_type for the volume resource, but the server does not have a image_name, then a 500 error will be displayed. We opened a ticket for this for another team and we will reply wen we'll have some updates.