Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unableto create empty volume #324

Open
is2admin opened this issue Oct 6, 2022 · 18 comments
Open

unableto create empty volume #324

is2admin opened this issue Oct 6, 2022 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@is2admin
Copy link

is2admin commented Oct 6, 2022

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

@is2admin is2admin added the bug Something isn't working label Oct 6, 2022
@cristiGuranIonos
Copy link
Collaborator

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

@lachnerd
Copy link

lachnerd commented Oct 7, 2022

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.

@cristiGuranIonos
Copy link
Collaborator

You can try to set licence_type to "Unknown", see if that helps.

@jbuchhammer
Copy link

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.

@lachnerd
Copy link

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"
│ } ]
│ }
'''

@gabriel-savu
Copy link
Contributor

Hello, we will take a look and then will inform you when we'll have a solution.

@cristiGuranIonos
Copy link
Collaborator

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!

@gabriel-savu
Copy link
Contributor

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.

@lachnerd
Copy link

lachnerd commented Nov 2, 2022

│ 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...

@gabriel-savu
Copy link
Contributor

gabriel-savu commented Nov 3, 2022

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.

@lachnerd
Copy link

lachnerd commented Nov 3, 2022

hello, this is the error for the plan that I provided above?

yap, correct

@gabriel-savu
Copy link
Contributor

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

@lachnerd
Copy link

lachnerd commented Nov 4, 2022

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
}```

@gabriel-savu
Copy link
Contributor

gabriel-savu commented Nov 4, 2022

can you please attach the server too to a message here be more easy to reproduce?

@lachnerd
Copy link

lachnerd commented Nov 4, 2022

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]
  }
}

@gabriel-savu
Copy link
Contributor

Thank you, I'll try to reproduce and come with some updates

@gabriel-savu
Copy link
Contributor

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.

@gabriel-savu
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants