Skip to content

Commit

Permalink
fix(lambda): use IRole instead of Role to allow imports (#1509)
Browse files Browse the repository at this point in the history
In order to allow passing in an imported role to a Lambda/Alias,
we must use `IRole` instead of `Role`.
  • Loading branch information
Elad Ben-Israel committed Jan 10, 2019
1 parent d7371f0 commit b909dcd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/lib/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class Alias extends FunctionBase {
/**
* Role associated with this alias
*/
public readonly role?: iam.Role | undefined;
public readonly role?: iam.IRole | undefined;

protected readonly canCreatePermissions: boolean = true; // Not used anyway

Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-lambda/lib/lambda-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface IFunction extends cdk.IConstruct, events.IEventRuleTarget, logs
/**
* The IAM role associated with this function.
*/
readonly role?: iam.Role;
readonly role?: iam.IRole;

/**
* Whether or not this Lambda function was bound to a VPC
Expand Down Expand Up @@ -123,7 +123,7 @@ export interface FunctionImportProps {
*
* If the role is not specified, any role-related operations will no-op.
*/
role?: iam.Role;
role?: iam.IRole;

/**
* Id of the securityGroup for this Lambda, if in a VPC.
Expand All @@ -149,7 +149,7 @@ export abstract class FunctionBase extends cdk.Construct implements IFunction {
/**
* The IAM role associated with this function.
*/
public abstract readonly role?: iam.Role;
public abstract readonly role?: iam.IRole;

/**
* Whether the addPermission() call adds any permissions
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-lambda/lib/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export interface FunctionProps {
* @default a unique role will be generated for this lambda function.
* Both supplied and generated roles can always be changed by calling `addToRolePolicy`.
*/
role?: iam.Role;
role?: iam.IRole;

/**
* VPC network to place Lambda network interfaces
Expand Down Expand Up @@ -284,7 +284,7 @@ export class Function extends FunctionBase {
/**
* Execution role associated with this function
*/
public readonly role?: iam.Role;
public readonly role?: iam.IRole;

/**
* The runtime configured for this lambda.
Expand Down Expand Up @@ -493,7 +493,7 @@ export class Function extends FunctionBase {
export class ImportedFunction extends FunctionBase {
public readonly functionName: string;
public readonly functionArn: string;
public readonly role?: iam.Role;
public readonly role?: iam.IRole;

protected readonly canCreatePermissions = false;

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda/lib/singleton-lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface SingletonFunctionProps extends FunctionProps {
export class SingletonFunction extends FunctionBase {
public readonly functionName: string;
public readonly functionArn: string;
public readonly role?: iam.Role | undefined;
public readonly role?: iam.IRole | undefined;
protected readonly canCreatePermissions: boolean;
private lambdaFunction: IFunction;

Expand Down

0 comments on commit b909dcd

Please sign in to comment.