From 9b4b9a46b309adcd9e9ad1e7c42b0487d3054b7f Mon Sep 17 00:00:00 2001 From: haarchri Date: Sun, 7 Nov 2021 10:14:04 +0100 Subject: [PATCH] fix(injected-identity): fix multioregion with injected identity since 0.20.0 Signed-off-by: haarchri --- pkg/clients/aws.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/clients/aws.go b/pkg/clients/aws.go index aa625c05e1..ad95def405 100644 --- a/pkg/clients/aws.go +++ b/pkg/clients/aws.go @@ -259,7 +259,10 @@ func UseProviderSecret(ctx context.Context, data []byte, profile, region string) // UsePodServiceAccount assumes an IAM role configured via a ServiceAccount. // https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html func UsePodServiceAccount(ctx context.Context, _ []byte, _, region string) (*aws.Config, error) { - cfg, err := config.LoadDefaultConfig(ctx) + cfg, err := config.LoadDefaultConfig( + ctx, + config.WithRegion(region), + ) if err != nil { return nil, errors.Wrap(err, "failed to load default AWS config") } @@ -339,7 +342,10 @@ func UseProviderSecretV1(_ context.Context, data []byte, pc *v1beta1.ProviderCon // UsePodServiceAccountV1 assumes an IAM role configured via a ServiceAccount. // https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html func UsePodServiceAccountV1(ctx context.Context, _ []byte, pc *v1beta1.ProviderConfig, _, region string) (*awsv1.Config, error) { - cfg, err := config.LoadDefaultConfig(ctx) + cfg, err := config.LoadDefaultConfig( + ctx, + config.WithRegion(region), + ) if err != nil { return nil, errors.Wrap(err, "failed to load default AWS config") }