Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider: set aws_rds_iam_region even if aws_rds_iam_profile is set #445

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions postgresql/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,14 @@ func getRDSAuthToken(region string, profile string, username string, host string
var awscfg aws.Config
var err error

loadOptions := []func(*awsConfig.LoadOptions) error{}
if profile != "" {
awscfg, err = awsConfig.LoadDefaultConfig(ctx, awsConfig.WithSharedConfigProfile(profile))
} else if region != "" {
awscfg, err = awsConfig.LoadDefaultConfig(ctx, awsConfig.WithRegion(region))
} else {
awscfg, err = awsConfig.LoadDefaultConfig(ctx)
loadOptions = append(loadOptions, awsConfig.WithSharedConfigProfile(profile))
}
if region != "" {
loadOptions = append(loadOptions, awsConfig.WithRegion(region))
}
awscfg, err = awsConfig.LoadDefaultConfig(ctx, loadOptions...)
if err != nil {
return "", err
}
Expand Down