From e82552708213acb8bf20768d918b7c5ebeb855b8 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Thu, 13 Dec 2018 16:40:40 -0800 Subject: [PATCH] fix(aws-cloudformation): change the type of Role in CodePipeline Actions to IRole. 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 --- .../app-delivery/lib/pipeline-deploy-stack-action.ts | 4 ++-- .../app-delivery/test/test.pipeline-deploy-stack-action.ts | 2 +- .../@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts b/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts index f13834de16804..7e8155a62a6e8 100644 --- a/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts +++ b/packages/@aws-cdk/app-delivery/lib/pipeline-deploy-stack-action.ts @@ -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 @@ -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; diff --git a/packages/@aws-cdk/app-delivery/test/test.pipeline-deploy-stack-action.ts b/packages/@aws-cdk/app-delivery/test/test.pipeline-deploy-stack-action.ts index 04e41a87540d4..3c5876a60a894 100644 --- a/packages/@aws-cdk/app-delivery/test/test.pipeline-deploy-stack-action.ts +++ b/packages/@aws-cdk/app-delivery/test/test.pipeline-deploy-stack-action.ts @@ -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) { diff --git a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts index 450275efcec42..e8e1ee3fcbfe7 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts +++ b/packages/@aws-cdk/aws-cloudformation/lib/pipeline-actions.ts @@ -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 @@ -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; @@ -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); }