IAM User.fromUserName does not implement IUser functions
See original GitHub issueWhen 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) https://github.com/aws/aws-cdk/pull/3738 (PR implementation of IUser) https://github.com/aws/aws-cdk/issues/3490 (issue associated with PR)
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
class User (construct) · AWS CDK - AWS Documentation
Type: SecretValue (optional, default: User won't be able to access the management console without a password.) The password for the user. This is...
Read more >Store does not implement IUserRoleStore<TUser ...
My solution is working with the SignInManager for passwords but I can not get it to get passed the error for Roles. ConfigureServices...
Read more >How to Import an Existing IAM User in AWS CDK | bobbyhadz
The most common method to import an existing IAM User in CDK is by the username. To import a user by the username...
Read more >awsiam - Go Packages
Customize the creation of IAM roles within the given scope. It is recommended that you **do not** use this method and instead allow...
Read more >@aws-cdk/aws-cognito - npm
Features such as Multi-factor authentication (MFAs) and Lambda Triggers are not configured by default. Use the grant() method to add an IAM policy...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@rix0rrr , I had the exact same usecase. Do you happen to know the reason why this was on purpose?
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.