hashicorp / hashicorp/packer-plugin-amazon

aws sso credentials failing to create ami

Open
#139 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
91
Forks
141
Avg merge
2d 18h
Merged PRs (30d)
3

Description

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

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

#### Overview of the Issue

when using packer amazon-ebs with credentials coming from aws sso it fails.
I use access keys and secret key generated via aws sso portal

#### Reproduction Steps

set keys obtain via sso
export AWS_ACCESS_KEY_ID="XXXXX"
export AWS_SECRET_ACCESS_KEY="XXXXXX"
export AWS_SESSION_TOKEN="XXXXXX="

packer build deploy.json

those creds works fine with terrraform.

### Packer version

From `packer version` 1.7.6

### Simplified Packer Buildfile
{
"builders": [
{
"type": "amazon-ebs",
"region": "eu-west-1",
"ami_description": "An AMI settings.",
"ami_name": "UB1804-{{isotime | clean_resource_name}}",
"instance_type": "t2.micro",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*",
"root-device-type": "ebs"
},
"most_recent": true,
"owners": [
"099720109477"
]
},
"ssh_username": "ubuntu",
"communicator": "ssh"
}
]
}

### Operating system and Environment details

macos bigsur version 11.6 (intel cpu)

### Log Fragments and crash.log files

amazon-ebs: output
==> amazon-ebs: Prevalidating any provided VPC information
==> amazon-ebs: Prevalidating AMI Name: UB1804-2021-10-06T08-19-23Z
amazon-ebs: Found Image ID: ami-007d44f7d32b4e37f
==> amazon-ebs: Creating temporary keypair: packer_615d5c0b-5d1d-81b0-bec6-90b1d48d3f6b
==> amazon-ebs: Creating temporary security group for this instance: packer_615d5c10-c04b-14ad-4a18-fcaafa62046e
==> amazon-ebs: Authorizing access to port 22 from [0.0.0.0/0] in the temporary security groups...
==> amazon-ebs: Launching a source AWS instance...
==> amazon-ebs: Adding tags to source instance
amazon-ebs: Adding tag: "Name": "Packer Builder"
==> amazon-ebs: Error launching source instance: UnauthorizedOperation: You are not authorized to perform this operation. Encoded authorization failure mess

decode message gives info that :assumed-role/AWSReservedSSO_AdministratorAccess has no right to launch instance.

Set the env var `PACKER_LOG=1` for maximum log detail.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.