-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: Allow AssumeRoleARN and credential validation call to shortcut account ID and partition lookup #5177
Conversation
How about introducing a |
…cut account ID and partition lookup * If provider configuration is set to assume role, use ARN to bypass account information calls * If provider credential validation is enabled, use results to bypass account information calls * Refactor GetAccountID back to GetAccountInformation to ensure non-SDK-default partitions can be handled * Refactor GetAccountInformation testing
cdfa7ea
to
2b455af
Compare
2b455af
to
b967cac
Compare
Updated to use |
…untIDAndPartition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing
aws/auth_helpers_test.go
Outdated
if err == nil { | ||
t.Fatalf("Expected error when parsing invalid ARN (%q)", invalidArn) | ||
for _, testCase := range testCases { | ||
accountID, partition, err := parseAccountInformationFromARN(testCase.InputARN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this use t.Run
?
aws/auth_helpers_test.go
Outdated
iamConn := iam.New(iamSess) | ||
stsConn := sts.New(stsSess) | ||
for _, testCase := range testCases { | ||
closeSts, stsSess, err := getMockedAwsApiSession("STS", testCase.MockEndpoints) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this use t.Run
(or at least have a func in here for the defer
)?
aws/auth_helpers_test.go
Outdated
stsConn := sts.New(stsSess) | ||
for _, testCase := range testCases { | ||
closeIam, iamSess, err := getMockedAwsApiSession("IAM", testCase.MockEndpoints) | ||
defer closeIam() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Run
or another func to scope this defer
?
aws/auth_helpers_test.go
Outdated
if err == nil { | ||
t.Fatalf("Expected error when parsing invalid ARN (%q)", invalidArn) | ||
for _, testCase := range testCases { | ||
accountID, partition, err := parseAccountIDAndPartitionFromARN(testCase.InputARN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a t.Run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 👍
@ewbankkit good call on the return ordering being unclear, we talked about it internally, opted in this case to just name the function so it was explicit. |
This has been released in version 1.31.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Potentially supersedes: #5060
Changes proposed in this pull request:
Output from acceptance testing: (provided as a smoke test)