serverless-newrelic-lambda-layers
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -76,2 +76,6 @@ "use strict"; | ||
} | ||
get licenseKeySecretDisabled() { | ||
return (typeof this.config.disableLicenseKeySecret === "boolean" && | ||
this.config.disableLicenseKeySecret); | ||
} | ||
get functions() { | ||
@@ -127,23 +131,28 @@ return Object.assign.apply(null, this.serverless.service | ||
} | ||
// If the managed secret has already been created, | ||
// there should be policies for it. | ||
const secretAccess = yield this.checkForSecretPolicy(); | ||
let managedSecret; | ||
if (secretAccess.secretExists) { | ||
this.managedSecretConfigured = true; | ||
} | ||
else { | ||
// Secret doesn't exist, so create it | ||
managedSecret = yield new integration_1.default(this).createManagedSecret(); | ||
if (managedSecret && managedSecret.policyArn) { | ||
if (!this.licenseKeySecretDisabled) { | ||
// If the managed secret has already been created, | ||
// there should be policies for it. | ||
const secretAccess = yield this.checkForSecretPolicy(); | ||
let managedSecret; | ||
if (secretAccess.secretExists) { | ||
this.managedSecretConfigured = true; | ||
} | ||
else { | ||
// Secret doesn't exist, so create it | ||
managedSecret = yield new integration_1.default(this).createManagedSecret(); | ||
if (managedSecret && managedSecret.policyArn) { | ||
this.managedSecretConfigured = true; | ||
} | ||
} | ||
if (secretAccess.currentRegionPolicy.length > 0) { | ||
const policyArn = secretAccess.currentRegionPolicy[0].Arn; | ||
this.mgdPolicyArns = [...this.managedPolicyArns, policyArn]; | ||
} | ||
else if (this.managedSecretConfigured) { | ||
this.mgdPolicyArns = [ | ||
...this.managedPolicyArns, | ||
managedSecret.policyArn | ||
]; | ||
} | ||
} | ||
if (secretAccess.currentRegionPolicy.length > 0) { | ||
const policyArn = secretAccess.currentRegionPolicy[0].Arn; | ||
this.mgdPolicyArns = [...this.managedPolicyArns, policyArn]; | ||
} | ||
else if (this.managedSecretConfigured) { | ||
this.mgdPolicyArns = [...this.managedPolicyArns, managedSecret.policyArn]; | ||
} | ||
return; | ||
@@ -185,8 +194,10 @@ }); | ||
} | ||
// before adding layer, attach secret access policy | ||
// to each function's execution role: | ||
const resources = this.resources; | ||
Object.keys(resources) | ||
.filter(resourceName => resources[resourceName].Type === `AWS::IAM::Role`) | ||
.forEach(roleResource => this.applyPolicies(resources[roleResource].Properties)); | ||
if (!this.licenseKeySecretDisabled) { | ||
// before adding layer, attach secret access policy | ||
// to each function's execution role: | ||
const resources = this.resources; | ||
Object.keys(resources) | ||
.filter(resourceName => resources[resourceName].Type === `AWS::IAM::Role`) | ||
.forEach(roleResource => this.applyPolicies(resources[roleResource].Properties)); | ||
} | ||
const funcs = this.functions; | ||
@@ -193,0 +204,0 @@ const promises = []; |
{ | ||
"name": "serverless-newrelic-lambda-layers", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Serverless plugin for NewRelic APM AWS Lambda layers.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -282,2 +282,12 @@ # serverless-newrelic-lambda-layers | ||
#### `disableLicenseKeySecret` (optional) | ||
Only required if you want to disable creating license key in AWS Secrets Manager. Setting this as `true` would create NEW_RELIC_LICENSE_KEY environment variable for the New Relic Lambda Extension to access. | ||
```yaml | ||
custom: | ||
newRelic: | ||
disableLicenseKeySecret: true | ||
``` | ||
## Supported Runtimes | ||
@@ -284,0 +294,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70565
973
324