hashicorp / packer-plugin-amazon

Packer plugin for Amazon AMI Builder

Home Page:https://www.packer.io/docs/builders/amazon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

temporary_iam_instance_profile_policy_document doesn't use poller configs

imcdo opened this issue · comments

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

I have configured a temporary_iam_instance_profile_policy_document for an amazon-ebs source. However it always fails to create the role with

Timed out waiting for temporary role

it seems like instead of passing forward the global polling configs such that this is configurable, we are doing:
https://github.com/hashicorp/packer-plugin-amazon/blob/8e1e361e8d32e909f6fc8597625f7a0d95c088d0/builder/common/step_iam_instance_profile.go#LL119C16-L119C35

which calls WaitUntilRoleExistsWithContext with its default values of 20 attempts with a 1 second backoff instead we should pass in the poller config and allow users to configure this

https://github.com/aws/aws-sdk-go/blob/a5bef1542952d979233bd92569aa09eeb7686c6a/service/iam/waiters.go#L133-L134

Reproduction Steps

set temporary_iam_instance_profile_policy_document
and have it take more than 30 seconds for aws to create the role.

Steps to reproduce this issue

Plugin and Packer version

From packer version
1.0.9

Simplified Packer Buildfile

temporary_iam_instance_profile_policy_document {
Statement {
Action = [
"ecr:GetAuthorizationToken",
"ecr:DescribeImages",
"ecr:ListImages",
"ecr:BatchGetImage",
"ecr:DescribeRegistry",
"ecr:DescribeRepositories",
"ecr:ListTagsForResource",
"ecr:GetDownloadUrlForLayer"
]
Effect = "Allow"
Resource = ["*"]
}
Version = "2012-10-17"
}

Operating system and Environment details

OS, Architecture, and any other information you can provide about the
environment.
ubuntu20

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the gist of the log or
use the Github detailed format instead of posting it directly in the issue.

name.amazon-ebs.ubuntu: output will be in this color. 02:10
==> name.amazon-ebs.ubuntu: Prevalidating any provided VPC information 02:10
==> name.amazon-ebs.ubuntu: Prevalidating AMI Name: name-x86_64-392bf324d41345eeef878dd77aafa924 02:10
    name.amazon-ebs.ubuntu: Found Image ID: ami-<> 02:10
    name.amazon-ebs.ubuntu: Found VPC ID: vpc-<> 02:10
    name.amazon-ebs.ubuntu: Found Subnet ID: subnet-<> 02:10
==> name.ubuntu: Creating temporary keypair: packer_<> 02:10
==> name.amazon-ebs.ubuntu: Creating temporary security group for this instance: packer_<> 02:10
==> name.amazon-ebs.ubuntu: Authorizing access to port 22 from [0.0.0.0/0] in the temporary security groups... 02:11
==> name.amazon-ebs.ubuntu: Creating temporary instance profile for this instance: packer-<> 02:11
==> name.amazon-ebs.ubuntu: Creating temporary role for this instance: packer-<> 02:12
==> name.amazon-ebs.ubuntu: Deleting temporary role... 02:37
==> name.amazon-ebs.ubuntu: Deleting temporary instance profile... 02:37
  02:37
==> name.amazon-ebs.ubuntu: Deleting temporary keypair... 02:38
Build 'name.amazon-ebs.ubuntu' errored after 28 seconds 42 milliseconds: Timed out waiting for temporary role packer-<>: ResourceNotReady: exceeded wait attempts

When will this be released? The last release was two months ago. Even a beta or pre-release would allow me to use this fix as I am currently blocked by the wait timeout for temporary profiles. Unless there is a work-around?