Skip to content

Commit

Permalink
fix(aws-cloudformation): change the type of Role in CodePipeline Acti…
Browse files Browse the repository at this point in the history
…ons to IRole. (#1364)

BREAKING CHANGE: this changes the type of the `role` property in CFN CodePipeline Actions
from `Role` to `IRole`.

This is needed to use imported Roles when creating Actions.

Fixes #1361
  • Loading branch information
skinny85 committed Dec 18, 2018
1 parent 2759a6b commit 3d07e48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface PipelineDeployStackActionProps {
*
* @default A fresh role with admin or no permissions (depending on the value of `adminPermissions`).
*/
role?: iam.Role;
role?: iam.IRole;

/**
* Acknowledge certain changes made as part of deployment
Expand Down Expand Up @@ -97,7 +97,7 @@ export class PipelineDeployStackAction extends cdk.Construct {
/**
* The role used by CloudFormation for the deploy action
*/
public readonly role: iam.Role;
public readonly role: iam.IRole;

private readonly stack: cdk.Stack;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export = nodeunit.testCase({
adminPermissions: false,
role
});
test.deepEqual(role.id, deployAction.role.id);
test.same(deployAction.role, role);
test.done();
},
'users can specify IAM permissions for the deploy action'(test: nodeunit.Test) {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo
*
* @default A fresh role with full or no permissions (depending on the value of `adminPermissions`).
*/
role?: iam.Role;
role?: iam.IRole;

/**
* Acknowledge certain changes made as part of deployment
Expand Down Expand Up @@ -194,7 +194,7 @@ export interface PipelineCloudFormationDeployActionProps extends PipelineCloudFo
* Base class for all CloudFormation actions that execute or stage deployments.
*/
export abstract class PipelineCloudFormationDeployAction extends PipelineCloudFormationAction {
public readonly role: iam.Role;
public readonly role: iam.IRole;

constructor(parent: cdk.Construct, id: string, props: PipelineCloudFormationDeployActionProps, configuration: any) {
const capabilities = props.adminPermissions && props.capabilities === undefined ? CloudFormationCapabilities.NamedIAM : props.capabilities;
Expand Down Expand Up @@ -450,7 +450,7 @@ class SingletonPolicy extends cdk.Construct {
}).addResource(stackArnFromProps(props));
}

public grantPassRole(role: iam.Role): void {
public grantPassRole(role: iam.IRole): void {
this.statementFor({ actions: ['iam:PassRole'] }).addResource(role.roleArn);
}

Expand Down

0 comments on commit 3d07e48

Please sign in to comment.