-
Notifications
You must be signed in to change notification settings - Fork 163
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
Container hang when Okta token expires #85
Comments
While I know my token had expired, I wasn't using |
thanks! don't hesitate to also use the We recently worked with Vault revoking IAM keys (through IAM roles), and we encountered simple 403s - that was easy to handle. We'll try to simulate a credential expiration like yours asap: your trace will be very helpful when you can ( |
Hi @Gary-Armstrong, thanks for all theses precious bug reports 👌🏻 For long running operations, driftctl remain silent at the moment. So you definitively may want to run it with |
Better test.
Immediate error from aws cli.
Immediate error from terraform.
Remains at this point for four+ minutes in this experiment. On CTRL-C:
Immediate response. |
Thank you @Gary-Armstrong this is very helpful for us to replicate this bug on our side! |
Hi @Gary-Armstrong, I tried today to replicate your issue but unfortunately I couldn't :( This is what I had for AWS CLI and terraform plan And below for driftctl inside a docker container Can you try again with our latest version |
This time I just let it go while I went to a meeting, and eventually forgot about it. After 54 minutes it produced an error.
Time lapse occurs here.
I agree generally that it reports the error but I'd prefer it not take 54 minutes to do so. |
Unsure if this is important, but: |
Thanks a lot, as you are using error reporting, we got all required analytics on our side. We'll investigate this thanks a lot 🙏🏻 |
Sentry issue: DRIFTCTL-D |
Hey @Gary-Armstrong, we finally found what is the problem here. I will try to explain it as much as I can. Internally we use an older version of aws-sdk and an older version of the terraform-provider-aws (which also used an outdated aws-sdk version). Both of them don't support the use of SSO named profile as per AWS documentation. This was added in a recent PR here on aws-sdk repo. That's why we (and probably you) need to use the key pair named profile where you need to pass The problem occurs when your token expires: we don't renew the expired token and thus it hangs in an endless loop as described in this terraform issue. Indeed we both, driftctl and terraform, have the same problem if you use the exact same setup:
The first time you try it should work since the token is not expired yet. The second time here's what you should have: $ AWS_PROFILE=okta aws s3 ls
An error occurred (ExpiredToken) when calling the ListBuckets operation: The provided token has expired. $ AWS_PROFILE=okta driftctl scan
DEBU[0000] New provider library created
DEBU[0000] Found existing aws provider path=/Users/wbeuil/.driftctl/plugins/darwin_amd64/terraform-provider-aws_v3.19.0_x5
DEBU[0000] Starting new provider region=eu-west-3
DEBU[0000] Starting aws provider GRPC client region=eu-west-3
# it hangs from now on $ terraform plan
# it hangs from now on To conclude, for now on this version of driftctl there's not much we can do since we rely on bugged version. BUT I will open an issue to bump aws-sdk to at least v1.37.0 and terraform-provider-aws to at least v3.26.0 where SSO named profile (e.g. find below an example config) is supported and should take into account automatic renew of STS token as explained in the doc with this sentence:
|
I am indeed using a named profile, although I didn't directly specify it you can see I have $AWS_PROFILE in the docker command. In my case, when my credentials expire (one hour), I need to regenerate them myself because AWS CLI will not do it for me. We use a forked and modified https://github.com/oktadeveloper/okta-aws-cli-assume-role and the manual regen is part of my required workflow. As I said, this all seems generally correct and I thank you for looking into it. I can always simply CTRL-C out of the driftctl execution and regenerate my credentials. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Works with SSO support: #53
|
Hey @Gary-Armstrong |
Description
My Okta token expires after 60 minutes. When it expires and I use aws cli I see an error:
The container hangs in this case and does not display an error. Ideally it would halt and report an error.
Environment
How to reproduce
Use Okta SSO to generate ~/.aws/credentials
Let credentials expire
Possible Solution
I think simply halting and displaying an error is correct.
The text was updated successfully, but these errors were encountered: