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

chore!: renames lambda property to lambdaFunction #277

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class KeyPair extends Construct implements ITaggable {
/**
* The lambda function that is created
*/
public readonly lambda: aws_lambda.IFunction;
public readonly lambdaFunction: aws_lambda.IFunction;

/**
* ARN of the private key in AWS Secrets Manager
Expand Down Expand Up @@ -223,7 +223,7 @@ export class KeyPair extends Construct implements ITaggable {
);
}
}
this.lambda = this.ensureLambda(props.legacyLambdaName ?? false);
this.lambdaFunction = this.ensureLambda(props.legacyLambdaName ?? false);

this.tags = new TagManager(TagType.MAP, 'Custom::EC2-Key-Pair');
this.tags.setTag(createdByTag, ID);
Expand Down Expand Up @@ -251,27 +251,27 @@ export class KeyPair extends Construct implements ITaggable {
};

const key = new CustomResource(this, `EC2-Key-Pair-${props.keyPairName}`, {
serviceToken: this.lambda.functionArn,
serviceToken: this.lambdaFunction.functionArn,
resourceType: resourceType,
properties: lambdaProperties,
});

if (typeof props.kms !== 'undefined') {
props.kms.grantEncryptDecrypt(this.lambda.role!);
props.kms.grantEncryptDecrypt(this.lambdaFunction.role!);
key.node.addDependency(props.kms);
key.node.addDependency(this.lambda.role!);
key.node.addDependency(this.lambdaFunction.role!);
}

if (typeof props.kmsPrivateKey !== 'undefined') {
props.kmsPrivateKey.grantEncryptDecrypt(this.lambda.role!);
props.kmsPrivateKey.grantEncryptDecrypt(this.lambdaFunction.role!);
key.node.addDependency(props.kmsPrivateKey);
key.node.addDependency(this.lambda.role!);
key.node.addDependency(this.lambdaFunction.role!);
}

if (typeof props.kmsPublicKey !== 'undefined') {
props.kmsPublicKey.grantEncryptDecrypt(this.lambda.role!);
props.kmsPublicKey.grantEncryptDecrypt(this.lambdaFunction.role!);
key.node.addDependency(props.kmsPublicKey);
key.node.addDependency(this.lambda.role!);
key.node.addDependency(this.lambdaFunction.role!);
}

this.privateKeyArn = key.getAttString('PrivateKeyARN');
Expand Down