hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.85k stars 9.19k forks source link

[Enhancement]: Perform decode-authorization-message when the EC2 error is an encoded authorization message #29710

Open johann8384 opened 1 year ago

johann8384 commented 1 year ago

Description

When an operation results in an encoded error message, prior to printing the encoded message, attempt to call sts decode-authorization-message to provide the decoded result to the user.

╷ │ Error: creating EC2 Instance: UnauthorizedOperation: You are not authorized to perform this operation. Encoded authorization failure message: <ENCODED MESSAGE> │ status code: 403, request id: 1550870c-6e0b-4fac-ba19-1da46fef7f17

Affected Resource(s) and/or Data Source(s)

aws_instance

Potential Terraform Configuration

No response

References

https://docs.aws.amazon.com/cli/latest/reference/sts/decode-authorization-message.html

Would you like to implement a fix?

Yes

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

Gonveliz commented 1 year ago

I have the same problem. Could you solve it?

Gonveliz commented 1 year ago

I have the same problem. Could you solve it?

I'm using GHA with self-hosted runners

jpriebe commented 1 year ago

We are using gitlab pipelines, and we have a fairly elaborate setup of cross-account IAM that allows our pipelines to run in dozens of different accounts. End users do not have access to the roles used by the pipelines, so they don't have a way to decode the messages.

It would be great if this could be an option set in the aws provider to decode or not decode these encrypted auth messages.

Forte-RehamAdel commented 1 year ago

@jpriebe Please, did you find the solution because I have the same problem?