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

Add option to configure ec2_alias values #5846

Merged
merged 13 commits into from
Jan 9, 2019
Merged

Add option to configure ec2_alias values #5846

merged 13 commits into from
Jan 9, 2019

Conversation

vishalnayak
Copy link
Member

@vishalnayak vishalnayak commented Nov 26, 2018

Fixes #5709

@jefferai jefferai modified the milestones: 1.0.1, 1.0.2 Dec 12, 2018
@@ -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": {
Copy link
Contributor

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:
Copy link
Contributor

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?

Copy link
Member Author

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.

@tyrannosaurus-becks tyrannosaurus-becks self-assigned this Dec 20, 2018
@chrishoffman chrishoffman modified the milestones: 1.0.2, 1.0.3 Jan 7, 2019
@vishalnayak vishalnayak modified the milestones: 1.0.3, 1.0.2 Jan 8, 2019
}

const identityAliasIAMUniqueID = "unique_id"
const identityAliasIAMFullArn = "full_arn"
const identityAliasEC2InstanceID = "instance-id"
const identityAliasEC2ImageID = "image-id"
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@vishalnayak vishalnayak merged commit 7797805 into master Jan 9, 2019
@vishalnayak vishalnayak deleted the aws-ec2-alias branch January 9, 2019 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants