serverless-pseudo-parameters
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -14,2 +14,3 @@ 'use strict'; | ||
}; | ||
this.skipRegionReplace = _.get(serverless.service, 'custom.pseudoParameters.skipRegionReplace', false) | ||
} | ||
@@ -20,3 +21,11 @@ | ||
const template = this.serverless.service.provider.compiledCloudFormationTemplate; | ||
const skipRegionReplace = this.skipRegionReplace; | ||
const consoleLog = this.serverless.cli.consoleLog; | ||
consoleLog(`${chalk.yellow.underline('AWS Pseudo Parameters')}`); | ||
if (skipRegionReplace) { | ||
consoleLog('Skipping automatic replacement of regions with account region!'); | ||
} | ||
// loop through all resources, and check all (string) properties for any #{AWS::} | ||
@@ -55,7 +64,7 @@ // reference. If found, replace the value with an Fn::Sub reference | ||
function replaceChildNodes(dictionary, name){ | ||
function replaceChildNodes(dictionary, name) { | ||
_.forEach(dictionary, function(value, key){ | ||
// if a region name is mentioned, replace it with a reference | ||
if(typeof value === 'string' && containsRegion(value)) { | ||
// if a region name is mentioned, replace it with a reference (unless we are skipping automatic replacements) | ||
if(typeof value === 'string' && !skipRegionReplace && containsRegion(value)) { | ||
var regionFinder = new RegExp(regions().join("|")); | ||
@@ -80,3 +89,3 @@ value = value.replace(regionFinder, '#{AWS::Region}'); | ||
// this.serverless.cli.consoleLog(message); | ||
console.info('AWS Pseudo Parameter: ' + msg) | ||
consoleLog('AWS Pseudo Parameter: ' + msg) | ||
} | ||
@@ -83,0 +92,0 @@ } while (m); |
{ | ||
"name": "serverless-pseudo-parameters", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"devDependencies": {}, | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -8,3 +8,3 @@ Serverless AWS Pseudo Parameters | ||
You can now use `#{AWS::AccountId}` etc. in any of your config strings, and this plugin replaces those values with the proper pseudo parameter `Fn::Sub` CloudFormation function. | ||
You can now use `#{AWS::AccountId}`, `#{AWS::Region}`, etc. in any of your config strings, and this plugin replaces those values with the proper pseudo parameter `Fn::Sub` CloudFormation function. | ||
@@ -15,3 +15,3 @@ Installation | ||
``` | ||
```yaml | ||
plugins: | ||
@@ -27,3 +27,3 @@ - serverless-pseudo-parameters | ||
``` | ||
```yaml | ||
service: users-bucket-thingy | ||
@@ -45,3 +45,3 @@ | ||
``` | ||
```json | ||
"Type": "AWS::S3::Bucket", | ||
@@ -57,3 +57,3 @@ "Properties": { | ||
``` | ||
```yaml | ||
service: foobar-handler | ||
@@ -80,1 +80,9 @@ | ||
``` | ||
The plugin also automatically replace _hardcoded_ region in `serverless.yml`. This feature can be disabled using: | ||
```yaml | ||
custom: | ||
pseudoParameters: | ||
skipRegionReplace: true | ||
``` |
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
5771
82
83