# ResourceNotReady: failed waiting for successful resource state in packer

**URL:** <https://discuss.hashicorp.com/t/resourcenotready-failed-waiting-for-successful-resource-state-in-packer/44531>\
**Category:** Packer\
**Created:** [September 20, 2022, 12:53pm UTC](https://discuss.hashicorp.com/t/resourcenotready-failed-waiting-for-successful-resource-state-in-packer/44531 "2022-09-20T12:53:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iammuralisalapu](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/iammuralisalapu/32/30845_2.png) [@iammuralisalapu](https://discuss.hashicorp.com/u/iammuralisalapu)\
**Post date:** [September 20, 2022, 12:53pm UTC](https://discuss.hashicorp.com/t/resourcenotready-failed-waiting-for-successful-resource-state-in-packer/44531/1 "2022-09-20T12:53:34Z")

</div>

I have started using packer for 3 months and I have managed to build packer AMI successfully by using source AMI from amazon (owner). Suddenly I have a requirement or standard to follow as per organization policies to change source AMI from amazon to our customized golden AMI which is shared from another AWS account. Now there is a problem using this AMI as a source for the packer build I am getting this below error.

Note: organization also shared CMK for this AMI(Not sure how to use it, CMK/KMS looks like arn:aws:kms:us-east-1:account\_id:key/bbxxxx-xxxx-xxxx-xxx-xxxxxxxx5)

==\> example-packer.amazon-ebs.example: Error waiting for instance (i-xxxxxxxxxxf) to become ready: ResourceNotReady: failed waiting for successful resource state

==\> example-packer.amazon-ebs.example: Instance state change details: Client.InternalError: Client.InternalError: Client error on launch

my configuration looks like

```auto
source "amazon-ebs" "example" {
  ami_name = "${local.prefix}${var.image_name}-{{timestamp}}"
  ami_description = ""
  access_key = "${var.access_key}"
  secret_key = "${var.secret_key}"
  token = "${var.session_token}"
  instance_type = "m5d.8xlarge"
  region = "us-east-1"
  vpc_id = "${local.VPC_ID}"
  subnet_id = "${local.PUBLIC_SUBNET}"
  security_group_id = "${local.SECURITY_GROUP}"
  ssh_timeout = "10m"
  ssh_interface = "private_ip"
  communicator = "ssh"
  ssh_bastion_host = "ip"
  ssh_bastion_username = "user_name"
  ssh_bastion_private_key_file = "~/.ssh/id_rsa"

```

Our golden AMI which is shared from another AWS account has 3 block devices(`/dev/xvda=snap-xxxxxxx:10:true:gp2:encrypted` , `/dev/xvdb=snap-xxxxxxx:20:true:gp2:encrypted` , `/dev/xvdh=snap-xxxxxxxx:10:true:gp2:encrypted`) and a root device(`/dev/xvda`) attached to the AMI which is encrypted. I have that KMS key id. Is this the encrypted volume causing the failure in the resource state?

Q1.I am using role\_arn for executing this packer build through the GitLab pipeline. Is there something here to add to the role policy to pick up the KMS\_ID/ARN?

Q2. I have tried using launch\_block\_device\_mappings as below (No idea about the usage)

```auto
launch_block_device_mappings {
    device_name = "/dev/xvda"
    encrypted = true
    kms_key_id = "bbxxxx-xxxx-xxxx-xxx-xxxxxxxx5"
}

launch_block_device_mappings {
    device_name = "/dev/xvdb"
    encrypted = true
    kms_key_id = "bbxxxx-xxxx-xxxx-xxx-xxxxxxxx5"
}

launch_block_device_mappings {
    device_name = "/dev/xvdh"
    encrypted = true
    kms_key_id = "bbxxxx-xxxx-xxxx-xxx-xxxxxxxx5"
}

```

But the error remains the same here.

Goal: Here my aim is to take golden ami as source ami and on top of that I want to install some packages after installing my requirements then packer should create an AMI for further use.If i switch back to amazon ami it works fine.

Thanks in advance.
