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

Error at VM creation - InvalidParameterValue: "The provided value ('{name}') for the parameter 'Device' is invalid." #157

Open
wibru opened this issue Sep 5, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@wibru
Copy link

wibru commented Sep 5, 2022

Hi,

Terraform errors at VM creation very often with this kind of config.
The CreateVms POSTs sent to the API seems fine.

Terraform Version

$ terraform version
Terraform v1.2.8
on linux_amd64
+ provider registry.terraform.io/outscale-dev/outscale v0.5.4

Terraform Configuration Files

terraform {
  required_providers {
    outscale = {
      source  = "outscale-dev/outscale"
      version = "0.5.4"
    }
  }
}

provider "outscale" {
  region = "eu-west-2"
  access_key_id = "REDACTED"
  secret_key_id = "REDACTED"
}

resource "outscale_keypair" "default" {
  keypair_name = "default"
  public_key   = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC7az9QP1R58nTenu4lP9Y1gPR56lRojhY3VhYUlVt9x002mXx2ZwqychvcyJV+KuRAGp8lfOhTnrxsvzfejmM/YsooHxSiLNqzAJf9o+9ODAKtQ3WZ6rxQPUSwZDyH1Iw8ttTHkShBWeRuuQMBHNQTVubsdad41WMjq+A3BLLwYVv88a8WCOFVG+zyjX0IeLSIdtjdlCl1RAcO9rD+cjuivCDH25xJvsA+Pm59iE8Y1kquiHmM3Ku/SurHT2aiQiI+ojLUOEsDMcwCfwbviwzeko7aQLn3IBTamQ9c2vjebGCqKqSWI6V+y2w5V3UIyniFikdfXIT79cwjPEJz3NdX7IJXlTcAeeAkWWKWNRypKIglCewIYqnB5FjlrM6jqJpwrK9sQvrUHN7qYSKC1Q7zzdXSwoxVAG6L8SoDWYvIcgKJnLmKtPes/Lkhgd2r8TZoahte+eKdxk10QQLajfyY9ccWHiF+7nfDPFCK6myod6bEM8CUUlBSv5wY5vKAncjBj7viiR+ZIBPUl2QgRHRHcJZU7dSeHhNFq9c2tE8aFBBHdEfb9tbtAL+/FoNqu3w4jsd6Wwdhl8cJahcURcMiFqqW+1pQYl5f5AQ0fcqRaa+EKBrw8pQAtLJcKtRyZg/t6jKAq5OrXCFkiZeOjcyWMJnLfF13iexRctpOpuiMVQ=="
}

resource "outscale_net" "default" {
  ip_range = "192.168.0.0/24"
  tenancy  = "default"
}

resource "outscale_internet_service" "default" {}

resource "outscale_internet_service_link" "default" {
  internet_service_id = outscale_internet_service.default.internet_service_id
  net_id              = outscale_net.default.net_id
}

resource "outscale_subnet" "default" {
  net_id         = outscale_net.default.net_id
  subregion_name = "eu-west-2a"
  ip_range       = "192.168.0.0/25"
}

resource "outscale_route_table" "default" {
  net_id = outscale_net.default.net_id
}

resource "outscale_route_table_link" "default" {
  subnet_id      = outscale_subnet.default.subnet_id
  route_table_id = outscale_route_table.default.route_table_id
}

resource "outscale_route" "default" {
  gateway_id = outscale_internet_service.default.internet_service_id
  destination_ip_range = "0.0.0.0/0"
  route_table_id       = outscale_route_table.default.route_table_id
}

resource "outscale_vm" "test1" {
    count = 3
    image_id                 = "ami-679921a7"
    vm_type                  = "tinav2.c1r2p3"
    keypair_name             = outscale_keypair.default.keypair_name
    security_group_ids       = []
    placement_subregion_name = "eu-west-2a"
    placement_tenancy        = "default"
    subnet_id                = outscale_subnet.default.subnet_id
    block_device_mappings {
      device_name = "/dev/sda1"
      bsu  {
        volume_size = 10
        volume_type = "gp2"
        delete_on_vm_deletion = true
      }
    }
}

resource "outscale_volume" "vol1" {
  count          = 3
  subregion_name = "eu-west-2a"
  size           = 10
  volume_type    = "gp2"
}

resource "outscale_volumes_link" "vol1" {
  count       = 3
  device_name = "/dev/xvdb"
  volume_id   = outscale_volume.vol1[count.index].volume_id
  vm_id       = outscale_vm.test1[count.index].id
}

resource "outscale_volume" "vol2" {
  count          = 3
  subregion_name = "eu-west-2a"
  size           = 10
  volume_type    = "gp2"
}

resource "outscale_volumes_link" "vol2" {
  count       = 3
  device_name = "/dev/xvdc"
  volume_id   = outscale_volume.vol2[count.index].volume_id
  vm_id       = outscale_vm.test1[count.index].id
}

resource "outscale_volume" "vol3" {
  count          = 3
  subregion_name = "eu-west-2a"
  size           = 10
  volume_type    = "io1"
  iops           = 250
}

resource "outscale_volumes_link" "vol3" {
  count       = 3
  device_name = "/dev/xvdd"
  volume_id   = outscale_volume.vol3[count.index].volume_id
  vm_id       = outscale_vm.test1[count.index].id
}

resource "outscale_vm" "test2" {
    count = 2
    image_id                 = "ami-679921a7"
    vm_type                  = "tinav2.c1r1p3"
    keypair_name             = outscale_keypair.default.keypair_name
    security_group_ids       = []
    placement_subregion_name = "eu-west-2a"
    placement_tenancy        = "default"
    subnet_id                = outscale_subnet.default.subnet_id
    block_device_mappings {
      device_name = "/dev/sda1"
      bsu  {
        volume_size = 10
        volume_type = "gp2"
        delete_on_vm_deletion = true
      }
    }
}

Debug Output

$ TF_LOG=TRACE terraform apply -no-color -auto-approve 2>&1 | tee /tmp/tf_trace.out

https://gist.github.com/wibru/c27dee54a6bbf3a5f440eabad8ef6f83

Expected Behavior

VM are created successfully

Actual Behavior

The most of the time, error at creation time for some VMs.

Error: Error creating route: 400 Bad Request

  with outscale_route.default,
  on main.tf line 48, in resource "outscale_route" "default":
  48: resource "outscale_route" "default" {


Error: Error launching source VM: 400 Bad Request {
  "Errors": [
    {
      "Code": "4019",
      "Details": "The provided value ('{name}') for the parameter 'Device' is invalid.",
      "Type": "InvalidParameterValue"
    }
  ],
  "ResponseContext": {
    "RequestId": "f948a53c-6669-41de-b9f4-c7b95e294323"
  }
}

  with outscale_vm.test2[0],
  on main.tf line 143, in resource "outscale_vm" "test2":
 143: resource "outscale_vm" "test2" {

Steps to Reproduce

Use proper access and secret key in the provider block then:

  1. terraform init
  2. terraform apply -auto-approve

You may have to do multiple destroy/apply to trigger the error.

@wibru wibru added the bug Something isn't working label Sep 5, 2022
@outscale-toa
Copy link
Member

Hi @wibru,
Thanks for reaching us, we are looking at your issue.

Best regards,

@outscale-toa
Copy link
Member

outscale-toa commented Sep 8, 2022

Hello @wibru
After investigation we have a platform issue,
We will mark the issue as solved once the platform is fixed.

Thanks, best regards

@babidi34
Copy link

babidi34 commented Jun 4, 2024

Hello,
I resolved this error by adding device_name = "/dev/sda1"
but now I'm getting the error:
Error: Error launching source VM: 400 Bad Request { │ "Errors": [ │ { │ "Code": "5071", │ "Details": "", │ "Type": "InvalidResource" │ }

@outscale-toa
Copy link
Member

Hello @babidi34,

Your error is due to a wrong name for your Keypair in the vm resource.
Perhaps your keypair has been manually deleted.

Best regards

@babidi34
Copy link

babidi34 commented Jun 7, 2024

Hello,

yes it was the wrong keypair name, thank you

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

No branches or pull requests

3 participants