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

IAM User.fromUserName does not implement IUser functions #5797

Closed
seawatts opened this issue Jan 14, 2020 · 5 comments
Closed

IAM User.fromUserName does not implement IUser functions #5797

seawatts opened this issue Jan 14, 2020 · 5 comments
Assignees
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md in-progress This issue is being actively worked on. p1

Comments

@seawatts
Copy link

seawatts commented Jan 14, 2020

When trying to create an IAM User from @aws-cdk/aws-iam with User.fromUserName the following IUser functions throw an erro.

  • addToGroup
  • attachInlinePolicy
  • addManagedPolicy

https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-iam/lib/user.ts#L145-L154

Reproduction Steps

import { PolicyStatement, User } from '@aws-cdk/aws-iam';

const importedUser = User.fromUserName(this, 'ImportedUser', 'my-user');
importedUser.attachInlinePolicy(new PolicyStatement({...}));

Error Log

Cannot add inline policy to imported User

Environment

  • CLI Version : 1.20.0
  • Framework Version : 1.20.0
  • OS : Mac OS
  • Language : Typescript 3.7.0

Other

https://gitter.im/awslabs/aws-cdk?at=5dc31ea914d55a3785e7ca39 (Other people are having this problem)
#3738 (PR implementation of IUser)
#3490 (issue associated with PR)


This is 🐛 Bug Report

@seawatts seawatts added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 14, 2020
@SomayaB SomayaB added the @aws-cdk/aws-iam Related to AWS Identity and Access Management label Jan 15, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 15, 2020

More of a feature request than a bug. We didn't implement this on purpose (apparently).

Can you describe your use case?

@rix0rrr rix0rrr added feature-request A feature should be added or improved. and removed bug This issue is a bug. labels Jan 15, 2020
@seawatts
Copy link
Author

There was a user created manually in my aws account and now I need to add extra policies to that user.

@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Jan 15, 2020
@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md labels Jan 23, 2020
@rangoju
Copy link
Contributor

rangoju commented Jan 31, 2020

@rix0rrr , I had the exact same usecase. Do you happen to know the reason why this was on purpose?

@rix0rrr rix0rrr added the p1 label Aug 12, 2020
@mariusingjer
Copy link

We have the exact same scenario: iam user creation is disabled, they opened up for a short time so we could manually create a build user for our service, now I want to configure that build user with CDK.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md in-progress This issue is being actively worked on. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants