ilayanambi86 / serverless-plugin-resource-tagging Goto Github PK
View Code? Open in Web Editor NEWAdd tags to resources
Add tags to resources
I'll create a pull request to skip applying resource tags in this scenario. Documenting issue here for reference.
Issue: When an AWS resource has a root Properties
-level CloudFormation conditional, this plugin still applies the Tags
property, which breaks at deploy-time.
Sample in serverless.yml
provider:
name: aws
# ...
stackTags:
MyOrg:Name: github issue sample
custom:
bucketProps:
Fn::If:
- IsOtherRegionDeployed
- ${file(additional.yml):BucketProps.withReplication}
- ${file(additional.yml):BucketProps.noReplication}
resources:
# ...
Resources:
Bucket:
Type: AWS::S3::Bucket
Properties: ${self:custom.bucketProps}
Sample in cloudformation-template-update-stack.json
"Bucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"Fn::If": [ // CloudFormation conditional evaluated at deploy-time
"IsOtherRegionDeployed",
{
// with replication...
},
{
// no replication
}
],
"Tags": [ // breaks the CloudFormation deploy due to conditional Fn::If
{
"Key": "MyOrg:Name",
"Value": "github issue sample"
}
]
}
},
Upgrade underscore to version 1.12.1 or later. For example:
"dependencies": {
"underscore": ">=1.12.1"
}
This plugin works for every supported AWS resource listed here except Dynamo Tables. Any workaround to make it work against Dyanamo Tables?
I am using this plugin under the provider section of serverless like below.
plugins:
- serverless-plugin-resource-tagging
provider:
name: aws
stackTags:
STACK: "${self:service}"
PRODUCT: "Produuct"
PRODUCT_VERSION: "1.0"
Although it works as expected with an S3 Bucket, CloudFormation, Kinesis, Lambda and API GATEWAYS.
I saw that this project has a dependency on the version 0.0.0
of the user
package from npm: https://github.com/ilayanambi86/serverless-plugin-resource-tagging/blob/master/package.json#L29
Taking a look at its code in https://www.npmjs.com/package/user?activeTab=explore, we've found it to strangely contain absolutely nothing expect this:
module.exports = function() {
return 'soon...';
};
Why exactly this was added as a dependency here?
Would it be possible to add support for some more common AWS resources, some possibilities might be:
With multi-stack repository we have ApiGateway created in one stack and used in other stacks. So the "API" stack looks like this:
service: api
plugins:
- serverless-plugin-resource-tagging
provider:
name: aws
stage: ${opt:stage}
stackTags: ${file(../config.json):tags}
resources:
Resources:
ApiGateway:
Type: AWS::ApiGateway::RestApi
Properties:
Name: ${self:custom.baseName}
After deployment process fails with error:
Stage dev on RestApi xxxxxxxxxx was not found
This looks like the plugin find that stack contains API Gateway and tries to find the Stage in it, and fails if it does not exist. Instead, it should just ignore it and not throw an error.
this.serverless.variables.options
is undefinedoptions
instead, as suggested hereA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.