packer-plugin-amazon icon indicating copy to clipboard operation
packer-plugin-amazon copied to clipboard

Parallel build of AMIs fails consistently

Open hc-github-team-packer opened this issue 3 years ago • 0 comments

This issue was originally opened by @diaasami in https://github.com/hashicorp/packer/issues/11976 and has been migrated to this repository. The original issue description is below.


Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Overview of the Issue

When building multiple amazon AMIs, one of them always fails with ResourceNotReady: exceeded wait attempts. Adding aws_polling block doesn't help, I tried up to a combined wait of up to 3 hours. Running the same packer config with parallel builds disabled (-parallel-builds=1) succeeds without even aws_polling block.

Reproduction Steps

Steps to reproduce this issue

  1. Save the file below as aws-ubuntu.pkr.hcl in an arbitrary new folder.
  2. Run packer build . in the same folder

Notes:

  • I tried adding a plugin block to update the amazon plugin but the result was the same.
  • I have also tried using the docker image hashicorp/packer instead of the locally installed packer but the result was the same.

Packer version

Packer v1.8.3

Simplified Packer Template

source "amazon-ebs" "ubuntu" {
  ami_name     = "learn-packer-linux-aws"
  region       = "us-east-1"
  ssh_username = "ubuntu"

  # Remove previous image before making the new one.
  force_deregister      = true
  force_delete_snapshot = true
}

build {
  source "amazon-ebs.ubuntu" {
    name          = "test-packer-x86"
    instance_type = "t2.micro"

    source_ami_filter {
      filters = {
        name                = "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"
        root-device-type    = "ebs"
        virtualization-type = "hvm"
      }
      most_recent = true
      owners      = ["099720109477"]
    }
  }

  source "amazon-ebs.ubuntu" {
    name          = "test-packer-aarch64"
    instance_type = "c6g.large"
 
    source_ami_filter {
      filters = {
        name                = "ubuntu/images/*ubuntu-xenial-16.04-arm64-server-*"
        root-device-type    = "ebs"
        virtualization-type = "hvm"
      }
      most_recent = true
      owners      = ["099720109477"]
    }
  }
}

Operating system and Environment details

Fedora 35, x86_64

hc-github-team-packer avatar Sep 29 '22 00:09 hc-github-team-packer