From 7d227a5172206851d16cc5fd387f625d302a1eca Mon Sep 17 00:00:00 2001 From: Muvaffak Onus Date: Sun, 5 Jun 2022 11:20:55 +0300 Subject: [PATCH] providerconfig: make sure v1 auth path checks for assumeRole field as well Signed-off-by: Muvaffak Onus --- pkg/clients/aws.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/clients/aws.go b/pkg/clients/aws.go index b245d99f3b..5a78da0951 100644 --- a/pkg/clients/aws.go +++ b/pkg/clients/aws.go @@ -456,7 +456,7 @@ func GetConfigV1(ctx context.Context, c client.Client, mg resource.Managed, regi } switch s := pc.Spec.Credentials.Source; s { //nolint:exhaustive case xpv1.CredentialsSourceInjectedIdentity: - if pc.Spec.AssumeRoleARN != nil { + if pc.Spec.AssumeRoleARN != nil || pc.Spec.AssumeRole != nil { cfg, err := UsePodServiceAccountV1AssumeRole(ctx, []byte{}, pc, DefaultSection, region) if err != nil { return nil, errors.Wrap(err, "cannot use pod service account to assume role") @@ -744,10 +744,8 @@ func SetResolverV1(pc *v1beta1.ProviderConfig, cfg *awsv1.Config) *awsv1.Config // GetAssumeRoleARN gets the AssumeRoleArn from a ProviderConfigSpec func GetAssumeRoleARN(pcs *v1beta1.ProviderConfigSpec) (*string, error) { - if pcs.AssumeRole != nil { - if pcs.AssumeRole.RoleARN != nil && StringValue(pcs.AssumeRole.RoleARN) != "" { - return pcs.AssumeRole.RoleARN, nil - } + if pcs.AssumeRole != nil && StringValue(pcs.AssumeRole.RoleARN) != "" { + return pcs.AssumeRole.RoleARN, nil } // Deprecated. Use AssumeRole.RoleARN