-
Notifications
You must be signed in to change notification settings - Fork 185
Add the ability to set KMSKeyArn to a Lambda function #356
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,6 +176,7 @@ Lambda.prototype._params = (program, buffer) => { | |
| Environment: { | ||
| Variables: null | ||
| }, | ||
| KMSKeyArn: program.kmsKeyArn, | ||
| DeadLetterConfig: { | ||
| TargetArn: null | ||
| }, | ||
|
|
@@ -473,6 +474,7 @@ Lambda.prototype._uploadExisting = (lambda, params) => { | |
| 'Runtime': params.Runtime, | ||
| 'VpcConfig': params.VpcConfig, | ||
| 'Environment': params.Environment, | ||
| 'KMSKeyArn': params.KMSKeyArn, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't sure if I should include a conditional check here or not to add KMSKeyArn to the params.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a possible way to conditionally add it: diff --git a/lib/main.js b/lib/main.js
index 3f5735e..9791c7e 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -466,7 +466,7 @@ Lambda.prototype._uploadExisting = (lambda, params) => {
}, (err) => {
if (err) return reject(err)
- lambda.updateFunctionConfiguration({
+ lambda.updateFunctionConfiguration(Object.assign({
'FunctionName': params.FunctionName,
'Description': params.Description,
'Handler': params.Handler,
@@ -476,10 +476,10 @@ Lambda.prototype._uploadExisting = (lambda, params) => {
'Runtime': params.Runtime,
'VpcConfig': params.VpcConfig,
'Environment': params.Environment,
- 'KMSKeyArn': params.KMSKeyArn,
'DeadLetterConfig': params.DeadLetterConfig,
'TracingConfig': params.TracingConfig
- }, (err, data) => {
+ }, (typeof params.KMSKeyArn !== undefined) ? {'KMSKeyArn': params.KMSKeyArn}: {}),
+ (err, data) => {
if (err) return reject(err)
resolve(data)
})
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, the only way to find that out is to test it. Sometimes the AWS SDK makes a problem from passing |
||
| 'DeadLetterConfig': params.DeadLetterConfig, | ||
| 'TracingConfig': params.TracingConfig | ||
| }, (err, data) => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KMSKeyArn will only clear with an empty string. If left undefined no change will be processed. With this change not including the environment variable will clear it.
There isn't a need to conditionally add it.