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

Unable to set volume size on amazon-ebs #443

Open
lsq-ablair opened this issue Dec 15, 2023 · 0 comments
Open

Unable to set volume size on amazon-ebs #443

lsq-ablair opened this issue Dec 15, 2023 · 0 comments
Labels

Comments

@lsq-ablair
Copy link

May relate to #122.

When specifying an amazon-ebs builder, I'm trying to set the boot volume size with launch_block_device_mappings. By the above bug, I should set this to "xvda" for Windows root devices.

However, with the hcl code,

data "amazon-ami" "windows_server_2022" {
  filters = {
    name                = "Windows_Server-2022-English-Full-Base-*"
    root-device-type    = "ebs"
    virtualization-type = "hvm"
  }
  most_recent = true
  owners = ["801119661308"] # Amazon Official
  region = "us-east-1"
}

source "amazon-ebs" "this" {
  ami_name = "Test"
  ami_virtualization_type = "hvm"
  instance_type = "m3.xlarge"
  launch_block_device_mappings {
    # The C drive
    delete_on_termination = true
    device_name           = "xvda" #"/dev/xvda"
    volume_size           = 50
  }
  launch_block_device_mappings {
    delete_on_termination = true
    device_name           = "xvdb"
    volume_size           = 100
    volume_type           = "gp3"
  }
  region = "us-east-1"
  source_ami        = data.amazon-ami.windows_server_2022.id
  subnet_id         = var.subnet_id
  user_data      = templatefile(var.user_data_file, {winrm_password = data.external-raw.random_pass.result})
communicator     = "winrm"
  winrm_insecure = true
  winrm_port     = 5986
  winrm_use_ssl  = true
}

I get three volumes. The goal is to increase /dev/sda1 from 30 -> 50GB, but instead I get a new volume:

| device_name = "/dev/xvda" |
|--------|------|------|
| vol-006f0d5xxxx | /dev/sda1 | 30 | Attached | 2023/12/15 |
| vol-07130xxx | /dev/xvda | 50 | Attached | 2023/12/15 |
| vol-0a14a96xxx | xvdb | 100 | Attached |

| device_name = "xvda" |
|------|------|------|
| vol-0279fxxx | /dev/sda1 | 30 | Attached | 2023/12/15 |
| vol-03214xxx | xvda | 50 | Attached | 2023/12/15 |
| vol-0111xxx | xvdb | 100 | Attached |

The two xvdX volumes are kept separate and neither applies to the root volume. However, when I specify either /dev/sda or sda, I get an error:

  launch_block_device_mappings {
    # The C drive
    delete_on_termination = true
    device_name           = "/dev/sda"
    volume_size           = 50
  }

==> amazon-ebs.this: Error launching source instance: InvalidBlockDeviceMapping: Invalid 
==> amazon-ebs.this:    device name /dev/sda
==> amazon-ebs.this:    status code: 400, request id: cc529xxx-xxx

I believe this is a bug or regression. Or is there something wrong with the builder config?

@lsq-ablair lsq-ablair added the bug label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant