-
Notifications
You must be signed in to change notification settings - Fork 4.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
Add option to configure ec2_alias values #5846
Conversation
ac1ac8e
to
09ca161
Compare
@@ -18,6 +18,11 @@ func pathConfigIdentity(b *backend) *framework.Path { | |||
Default: identityAliasIAMUniqueID, | |||
Description: fmt.Sprintf("Configure how the AWS auth method generates entity aliases when using IAM auth. Valid values are %q and %q", identityAliasIAMUniqueID, identityAliasIAMFullArn), | |||
}, | |||
"ec2_alias": { |
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.
Since the above parameter has the old style of declaring the parameter type (&framework.FieldSchema
), could we run gofmt -s
on this file since we're here anyway? That would clean up the above and any other places that need updating in the file.
identityAlias := "" | ||
|
||
switch identityConfigEntry.EC2Alias { | ||
case identityAliasEC2InstanceID: |
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.
So am I right in thinking that this is the default path if neither have been set?
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.
Yes! The function identityConfigEntry
above will return default values for both EC2Alias
and IAMAlias
.
} | ||
|
||
const identityAliasIAMUniqueID = "unique_id" | ||
const identityAliasIAMFullArn = "full_arn" | ||
const identityAliasEC2InstanceID = "instance-id" | ||
const identityAliasEC2ImageID = "image-id" |
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.
Can we make these _
to match the IAM values?
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.
Fixed.
case entry.IAMAlias == "": | ||
entry.IAMAlias = identityAliasIAMUniqueID | ||
case entry.EC2Alias == "": | ||
entry.EC2Alias = identityAliasEC2InstanceID |
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.
I think we should change this incase both end up being "" for some reason, probably break this into two if statements
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.
Fixed.
Fixes #5709