Skip to content

Instantly share code, notes, and snippets.

@timmyers
Created October 4, 2022 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timmyers/8bf261e633a197397389cb0d1f40023d to your computer and use it in GitHub Desktop.
Save timmyers/8bf261e633a197397389cb0d1f40023d to your computer and use it in GitHub Desktop.
Pulumi IaC IAM User Change #2
import * as aws from '@pulumi/aws';
const defaultTags = { Creator: 'pulumi' };
const timUser = new aws.iam.User('tim.myers', {
name: 'tim.myers',
tags: defaultTags,
});
new aws.iam.UserPolicyAttachment('tim.myers-readonly', {
user: timUser.name,
policyArn: aws.iam.getPolicyOutput({ name: 'ReadOnlyAccess'}).arn,
});
new aws.iam.UserPolicyAttachment('tim.myers-password', {
user: timUser.name,
policyArn: aws.iam.getPolicyOutput({ name: 'IAMUserChangePassword'}).arn,
});
ew aws.iam.UserPolicy('tim.myers-infrastructure-role', {
user: timUser.name,
policy: {
Version: '2012-10-17',
Statement: [{
Effect: 'Allow',
Action: 'sts:AssumeRole',
Resource: infrastructureRole.arn,
}]
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment