Skip to content

Commit 0c1380d

Browse files
committed
fix: Correctly set the credentials token source
WIP: needs unit tests Fixes #2542
1 parent 235b7b0 commit 0c1380d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

internal/proxy/proxy.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,20 @@ func credentialsOpt(c Config, l cloudsql.Logger) (cloudsqlconn.Option, error) {
363363
if err != nil {
364364
return nil, err
365365
}
366+
367+
var iamAuthNEnabled bool
366368
if c.IAMAuthN {
369+
iamAuthNEnabled = true
370+
} else {
371+
for _, ic := range c.Instances {
372+
if ic.IAMAuthN != nil && *ic.IAMAuthN {
373+
iamAuthNEnabled = true
374+
break
375+
}
376+
}
377+
}
378+
379+
if iamAuthNEnabled {
367380
iamLoginTS, err := impersonate.CredentialsTokenSource(
368381
context.Background(),
369382
impersonate.CredentialsConfig{

0 commit comments

Comments
 (0)