Feature request: Follow AWS_DEFAULT_REGION standard environment variable
Use case
I use direnv heavily eg. HariSekhon/Environments to automatically configure my $AWS_DEFAULT_REGION among other environment variables to make all commands shorter and easier.
But eksup doesn't seem to follow the standard AWS environment variables so I have to specify the region explicitly.
It would be nice if eksup defaulted to following the standard AWS environment variables to improve UX slightly.
Solution/User Experience
So I have to specify --region eu-west-1 explicitly as an argument for eksup analyze to find the cluster.
Alternative solutions
No response
it does - it uses the AWS SDK for Rust which respects the standard AWS credential chain. perhaps https://github.com/HariSekhon/Environments is not loading this in the correct manner?
Update: this is because the SDK is only supporting AWS_REGION while AWS CLIv2 documents using AWS_DEFAULT_REGION.
This is definitely set in the environment:
$ env | grep AWS_DEFAULT_REGION
AWS_DEFAULT_REGION=eu-west-1
This is used by AWS CLIv2 to set the right region.
When I run
$ eksup analyze --cluster $EKS_CLUSTER
ERROR eksup::eks::resources: Cluster mycluster not found
at eksup/src/eks/resources.rs:23
which implies it is not picking up the environment variable, but if I run this it finds it:
eksup analyze --cluster $EKS_CLUSTER --region $AWS_DEFAULT_REGION
If I repeat more explicitly:
$ export AWS_DEFAULT_REGION=eu-west-1
$ eksup analyze --cluster $EKS_CLUSTER
ERROR eksup::eks::resources: Cluster mycluster not found
at eksup/src/eks/resources.rs:23
Perhaps it's using a variable other than the AWS_DEFAULT_REGION one documented here which I regularly use for AWS CLI?
https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html
Testing again, I think it doesn't support the above, but rather AWS_REGION, as this works:
$ AWS_REGION=eu-west-1 eksup analyze --cluster $EKS_CLUSTER
I've updated my code to export both now.
Might be worth supporting both in your project too if possible?
Related discussion:
https://github.com/aws/aws-sdk-go/issues/2103
this is now supported https://github.com/clowdhaus/eksup/releases/tag/v0.11.0