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

Always pick us-east-1 for the "aws" partition #8679

Merged
merged 2 commits into from Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion builtin/credential/aws/backend.go
Expand Up @@ -307,8 +307,13 @@ func generatePartitionToRegionMap() map[string]*endpoints.Region {
partitions := resolver.(endpoints.EnumPartitions).Partitions()

for _, p := range partitions {
// Choose a single region randomly from the partition
// For most partitions, it's fine to choose a single region randomly.
// However, for the "aws" partition, it's best to choose "us-east-1"
// because it also support STS out of the box.
tyrannosaurus-becks marked this conversation as resolved.
Show resolved Hide resolved
for _, r := range p.Regions() {
if p.ID() == "aws" && r.ID() != "us-east-1" {
continue
}
partitionToRegion[p.ID()] = &r
break
}
Expand Down
7 changes: 7 additions & 0 deletions builtin/credential/aws/backend_test.go
Expand Up @@ -1813,3 +1813,10 @@ func generateRenewRequest(s logical.Storage, auth *logical.Auth) *logical.Reques

return renewReq
}

func TestGeneratePartitionToRegionMap(t *testing.T) {
m := generatePartitionToRegionMap()
if m["aws"].ID() != "us-east-1" {
t.Fatal("expected us-east-1 but received " + m["aws"].ID())
}
}