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

fix(iam): policy added to resource for immutable Role #5568

Merged
merged 3 commits into from
Dec 27, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-iam/lib/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class Role extends Resource implements IRole {

class ImmutableImport extends Import {
public addToPolicy(_statement: PolicyStatement): boolean {
return false;
return true;
}

public attachInlinePolicy(_policy: Policy): void {
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-iam/test/role.from-role-arn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ describe('IAM Role.fromRoleArn', () => {
addToPolicyResult = importedRole.addToPolicy(somePolicyStatement());
});

test('returns false', () => {
expect(addToPolicyResult).toBe(false);
test('pretends to succeed', () => {
expect(addToPolicyResult).toBe(true);
});

test("does NOT generate a default Policy resource pointing at the imported role's physical name", () => {
Expand Down Expand Up @@ -278,8 +278,8 @@ describe('IAM Role.fromRoleArn', () => {
addToPolicyResult = importedRole.addToPolicy(somePolicyStatement());
});

test('returns false', () => {
expect(addToPolicyResult).toBe(false);
test('pretends to succeed', () => {
expect(addToPolicyResult).toBe(true);
});

test("does NOT generate a default Policy resource pointing at the imported role's physical name", () => {
Expand Down