Open arielbeckjit opened 2 years ago
Voting for Prioritization
Volunteering to Work on This Issue
It looks like too many requests, is there any way to sleep / retry / perform only one assume role for all regions?
Hi, I'm facing the same issue and I really wants to see it fixed. So I'll be glad to help fixing it. But I'm not really known how to start ;-)
@justinretzolk , any clue to start investigation ?
Looking AWS CLI doc , it seems a credentials cache mechanism is in place. Does this mechanism is already in place in aws provider ?
I'm not using exactly the same config, I rely on profile
:
[profile account-name]
role_arn = arn:aws:iam::1234567890123:role/role_name}
web_identity_token_file = /path/to/web_identity_token_file
role_session_name = workflows
region = eu-central-1
The web identity token file (/path/to/web_identity_token_file
) is generated with
- uses: actions/github-script@v6
with:
script: |
const fs = require('fs/promises');
const path = require('path');
const awsConfigDir = path.resolve(process.env.HOME,'.aws');
var webIdentityToken = await core.getIDToken('sts.amazonaws.com');
await fs.mkdir(awsConfigDir, { recursive: true });
await fs.writeFile(path.resolve(awsConfigDir,'identity-token'), webIdentityToken);
I'm able to run raw AWS CLI commands without any errors :
aws sts get-caller-identity --profile=account-name
And finally got the same error with terraform
│ Error: WebIdentityErr: failed to retrieve credentials
│ caused by: InvalidIdentityToken: Couldn't retrieve verification key from your identity provider, please reference AssumeRoleWithWebIdentity documentation for requirements
│ status code: 400, request id: ........
│
Some others refs :
Since the authentication now retries, are you still seeing this error if you configure AWS_MAX_ATTEMPTS
?
@gdavison Is the change in a published version of the provider?
@gdavison Is the change in a published version of the provider?
Yes
Terraform Core Version
3.75.2
AWS Provider Version
latest (hashicorp/setup-terraform@v1)
Affected Resource(s)
When assuming a role with web identity, 99% the terraform plan / apply fails with
We are running the code through github actions, so we've set up "token.actions.githubusercontent.com" as identity provider, while the github role (who is full admin) has following trust:
To configure AWS i'm doing this:
then my actual tf code is (it's for around 14 regions)
in the module, i have the actual resource i'm creating (which is SNS with some configurations)
this is the module's versions.tf:
Expected Behavior
Terraform should create those resources in all resources, but i fail sometime at plan, sometime at apply, one time it passed.
Actual Behavior
It looks like no retries are done when failing the assume role, and thus - it looks like it gets a rate exception, and fails.
I cannot get pass plan (it succeeded only once). When using a regular admin credentials on my machine it works every time (As i guess it doesn't assume the role each time?).
i saw 2 times it failed at init.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Then the example of the module:
t``` erraform { required_version = ">= 0.15 " required_providers { aws = { source = "hashicorp/aws" version = "~> 3.0" } } }
resource "aws_sns_topic" "sns-topic-publish-all" { name = var.topic_name }