-
Notifications
You must be signed in to change notification settings - Fork 472
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
Support option to generate session token based on IAM User #370
Comments
it's not working for me as well, it uses the local keys of the self hosted runner even if i give it custom ones :( |
Can I get some clarification on how exactly you're trying to authenticate and what you're expecting the action to do? Please share your workflow file, thanks |
Hi @peterwoodworth, the authentication I was trying to do was fairly simple, it ended up having to be this :
If I omitted the role-to-assume in the "with" section, it would not generate a valid authentication in the env variables that are required for using terraform afterwards in the workflow. so in essence, if I am logging in with a simple username / password and not assuming any roles, then authentication would fail in the terraform init command. in other words : the ouput from aws-actions/configure-aws-credentials@v1 for setting up the env is / was not complete when not assuming a role in this example, the statefile is a file on a S3 bucket and a dynamo db is used for remote state locking is this clearer ? |
Thanks for the explanation @semora81, We don't currently support setting the session token when using keys as your authentication method and not supplying a role. To support that, we would need to implement an option to use the For now if you need to use a session token to authenticate with terraform, you will need to specify a role to assume. |
Yeah, assuming a role is what my code has ended up doing since I had opened this! I think I remember doing it manually with the Amazon CLI or curl, and yes, I had to call the getsessiontoken api to get a session token back, and then set it up in env, so I could call terraform. When I started this I had no role setup in the target account and I was trying to test with a service account we had setup in IAM. Thanks for the update! |
New Issue description
I would like to use this action to generate a session token based on an IAM User. This can be done by using the GetSessionToken API call
Original Issue
Hi, i've been trying to get the aws credentials initialized for a job and then run a terraform init on a s3 backend for the terraform state.
after running the configure-aws-credentials action there is no AWS_SESSION_TOKEN set.
I dumped the env var to validate :
AWS_DEFAULT_REGION=ca-central-1
AWS_REGION=ca-central-1
AWS_SECRET_ACCESS_KEY=***
AWS_ACCESS_KEY_ID=***
so when I get to running terraform it tells me : Error: error configuring S3 Backend: IAM Role xxxxx cannot be assumed.
When I look at the code, the function exportCredentials is where this env variable is set but, it is only referenced in two locations.
inside the assume role context , called with :
exportCredentials(roleCredentials);
early in the run function to export the accesKeyId and secretAccessKey env variables.
if I am not assuming a role, sessionToken is never initialized it seems and never exported.
am I missing something? pretty new to actions so any help will be appreciated!
The text was updated successfully, but these errors were encountered: