-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Packer's assume role functionality should not error out if the build itself is invoked with the role credentials #12110
Labels
Comments
Same here |
nywilken
added
the
sync to jira
For issues that need to be imported to Packer internal JIRA backlog
label
Feb 21, 2023
This issue has been synced to JIRA for planning. JIRA ID: HPR-983 |
Hi,
What is the status of this issue, there is no way to check linked Jira ticket.
sources.pkr.hcl source "amazon-ebs" "arm_al2023_no_swap" {
ami_name = "${local.prefix}-{{timestamp}}"
iam_instance_profile = "packer-instance-role"
instance_type = var.build_instance_type
region = var.region
skip_region_validation = true
ssh_username = "ec2-user"
source_ami_filter {
filters = {
name = var.source_ami_pattern
architecture = "arm64"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
}
assume_role {
role_arn = local.assume_role_arn
session_name = "packer-build-session"
}
tags = {
Name = "${local.prefix}-{{timestamp}}"
commit = var.source_commit
}
}
Error output:
Thanks, |
Any workaround or fix for this in 2024? We are facing the exact same issue |
Same problem. What's going on? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Packer version
Description
I created an IAM role (
packer-role
) with the following trust relationship:I then assumed the role and set the credentials:
and confirmed that the new credentials were correctly set:
I then tried to run the following Packer build:
this errors out:
Use Case(s)
My actual use case is a bit more complex.
I have a time consuming Packer build (>1 hour) which is being executed from a Gitlab CI pipeline. The job in the pipeline runs in another account (account B) and has a role associated to it. To run the Packer build in my account, I configured the job to assume the role in my account (account A). This would work fine if it wasn't for the fact that the build is longer than an hour. The sts assume role session chaining is in fact limited to one hour, which means that I can't use this workflow for my build.
I then tried to use the
assume_role
functionality, because my understanding is that by using it Packer would be able to refresh the credentials during the build, which would resolve my problem. The issue however, as illustrated above, is that Packer tries to assume the role even though the role is already assumed.Should Packer be smart enough to understand that it is running under the assumed role that I specified in the
assume_role
config, and avoid trying to assume it when the build starts?The text was updated successfully, but these errors were encountered: