Skip to content

Commit b47c58b

Browse files
inteoncert-manager-bot
authored andcommitted
set global region when calling sts
Signed-off-by: Tim Ramlot <[email protected]>
1 parent e5be55c commit b47c58b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/issuer/acme/dns/route53/route53.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ func (d *sessionProvider) GetSession(ctx context.Context) (aws.Config, error) {
8282
switch {
8383
case d.Role != "" && d.WebIdentityToken != "":
8484
d.log.V(logf.DebugLevel).Info("using assume role with web identity")
85-
optFns = append(optFns, config.WithRegion(d.Region))
8685
case useAmbientCredentials:
8786
d.log.V(logf.DebugLevel).Info("using ambient credentials")
8887
// Leaving credentials unset results in a default credential chain being
@@ -98,9 +97,14 @@ func (d *sessionProvider) GetSession(ctx context.Context) (aws.Config, error) {
9897
return aws.Config{}, fmt.Errorf("unable to create aws config: %s", err)
9998
}
10099

100+
// Explicitly set the region to aws-global so that AssumeRole can be used
101+
// with the global sts endpoint.
102+
stsCfg := cfg.Copy()
103+
stsCfg.Region = "aws-global"
104+
101105
if d.Role != "" && d.WebIdentityToken == "" {
102106
d.log.V(logf.DebugLevel).WithValues("role", d.Role).Info("assuming role")
103-
stsSvc := d.StsProvider(cfg)
107+
stsSvc := d.StsProvider(stsCfg)
104108
result, err := stsSvc.AssumeRole(ctx, &sts.AssumeRoleInput{
105109
RoleArn: aws.String(d.Role),
106110
RoleSessionName: aws.String("cert-manager"),
@@ -119,7 +123,7 @@ func (d *sessionProvider) GetSession(ctx context.Context) (aws.Config, error) {
119123
if d.Role != "" && d.WebIdentityToken != "" {
120124
d.log.V(logf.DebugLevel).WithValues("role", d.Role).Info("assuming role with web identity")
121125

122-
stsSvc := d.StsProvider(cfg)
126+
stsSvc := d.StsProvider(stsCfg)
123127
result, err := stsSvc.AssumeRoleWithWebIdentity(ctx, &sts.AssumeRoleWithWebIdentityInput{
124128
RoleArn: aws.String(d.Role),
125129
RoleSessionName: aws.String("cert-manager"),

0 commit comments

Comments
 (0)