Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 0030852

Browse files
ecoutEinar Coutin
and
Einar Coutin
authored
Multi stack support (#95)
* Add support for Multi-Stack Environments allowing Stack to be renamed. * Change Stack Descriptions * Changing Approach to using a Parameter with pre-designed names to avoid API validation errors like Role name lenght surpassing 64 characters * Lambda Function Name parameter to support multiple environments Stack Sets on Ruby Gem File * lambda function name in single region CF Stack Template for multi environment stacks * upgraded to nodejs 14x * Changed Description back to original Co-authored-by: Einar Coutin <[email protected]>
1 parent 98fef65 commit 0030852

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

cloud_formation/event_multi_region_template/autotag_event_collector-template.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
"Description" : "The region where the main auto-tag CloudFormation stack is running",
88
"Type" : "String",
99
"Default": "us-west-2"
10+
},
11+
"LambdaName": {
12+
"Description": "The name of the Lambda Function of the Main Stack Set.",
13+
"Type": "String",
14+
"Default": "AutoTag",
15+
"AllowedValues":[
16+
"AutoTag",
17+
"AutoTagDev"
18+
]
1019
}
1120
},
1221

@@ -127,7 +136,7 @@
127136
"AutoTagSNSSubscription": {
128137
"Type": "AWS::SNS::Subscription",
129138
"Properties": {
130-
"Endpoint": { "Fn::Sub": "arn:aws:lambda:${MainAwsRegion}:${AWS::AccountId}:function:AutoTag" },
139+
"Endpoint": { "Fn::Sub": "arn:aws:lambda:${MainAwsRegion}:${AWS::AccountId}:function:${LambdaName}" },
131140
"Protocol": "lambda",
132141
"TopicArn": {
133142
"Ref": "AutoTagSNSTopic"

cloud_formation/event_multi_region_template/autotag_event_main-template.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
"AWSTemplateFormatVersion": "2010-09-09",
33
"Description": "Auto Tag (Open Source by GorillaStack)",
44
"Parameters": {
5+
"LambdaName": {
6+
"Description": "The name of the Lambda Function.",
7+
"Type": "String",
8+
"Default": "AutoTag",
9+
"AllowedValues":[
10+
"AutoTag",
11+
"AutoTagDev"
12+
]
13+
},
514
"CodeS3Bucket": {
615
"Description": "The name of the code bucket in S3.",
716
"Type": "String",
@@ -10,7 +19,7 @@
1019
"CodeS3Path": {
1120
"Description": "The path of the code zip file in the code bucket in S3.",
1221
"Type": "String",
13-
"Default": "autotag-0.5.0.zip"
22+
"Default": "autotag-0.5.3.zip"
1423
},
1524
"AutoTagDebugLogging": {
1625
"Description": "Enable/Disable Debug Logging for the Lambda Function for all processed CloudTrail events.",
@@ -72,7 +81,9 @@
7281
}
7382
},
7483
"Description": "Auto Tag (Open Source by GorillaStack)",
75-
"FunctionName": "AutoTag",
84+
"FunctionName": {
85+
"Fn::Sub": "${LambdaName}"
86+
},
7687
"Handler": {
7788
"Fn::Sub": "autotag_event.handler"
7889
},

cloud_formation/event_multi_region_template/autotag_event_main-template.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
parameter 'CodeS3Path',
2020
Description: 'The path of the code zip file in the code bucket in S3.',
2121
Type: 'String',
22-
Default: 'autotag-0.5.0.zip'
22+
Default: 'autotag-0.5.3.zip'
23+
24+
parameter 'LambdaName',
25+
Description: 'The name of the Lambda Function.',
26+
Type: 'String',
27+
AllowedValues: %w(AutoTag AutoTagDev),
28+
Default: 'AutoTag'
2329

2430
parameter 'AutoTagDebugLogging',
2531
Description: 'Enable/Disable Debug Logging for the Lambda Function for all processed CloudTrail events.',
@@ -61,7 +67,7 @@
6167
S3Key: ref('CodeS3Path'),
6268
},
6369
Description: 'Auto Tag (Open Source by GorillaStack)',
64-
FunctionName: 'AutoTag',
70+
FunctionName: sub('${LambdaName}'),
6571
Handler: sub('autotag_event.handler'),
6672
Role: get_att('AutoTagExecutionRole', 'Arn'),
6773
Runtime: 'nodejs14.x',

cloud_formation/event_single_region_template/autotag_event-template.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"CodeS3Path" : {
1313
"Description" : "The path of the code zip file in the code bucket in S3",
1414
"Type" : "String",
15-
"Default" : "autotag-0.5.0.zip"
15+
"Default" : "autotag-0.5.3.zip"
1616
},
1717
"AutoTagDebugLogging": {
1818
"Description": "Enable/Disable Debug Logging for the Lambda Function for all processed CloudTrail events.",
@@ -62,7 +62,9 @@
6262
"S3Key": { "Ref" : "CodeS3Path" }
6363
},
6464
"Description" : "Auto Tag (Open Source by GorillaStack)",
65-
"FunctionName" : "AutoTag",
65+
"FunctionName" : {
66+
"Fn::Sub": "${AWS::StackName}"
67+
},
6668
"Handler" : "autotag_event.handler",
6769
"Role" : { "Fn::GetAtt" : [ "AutoTagExecutionRole", "Arn" ] },
6870
"Runtime" : "nodejs14.x",

0 commit comments

Comments
 (0)