Skip to content

Commit d8edef3

Browse files
authored
Merge pull request #159 from mapbox/unique-lambda-policy-names
Use unique names for the lambda policies
2 parents b7027fc + 35faf5e commit d8edef3

30 files changed

+49
-45
lines changed

changelog.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# Changelog
22

3+
## 9.1.0
4+
5+
- Change the policy name for the Lambda shortcuts to include the stack's LogicalName
6+
37
## 9.0.0
48

5-
- Removes:
9+
- Removes:
610
- aws-sdk as a runtime dependency.
711
- All node support prior to version 20.
8-
- Adds:
12+
- Adds:
913
- `@aws-sdk/client-cloudformation` as a runtime dependency.
10-
- Updates:
14+
- Updates:
1115
- bin/validate-template to use `@aws-sdk/client-cloudformation`.
1216
- Lambda shortcut lambda runtime default to use `node22.x`
1317

lib/shortcuts/lambda.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class Lambda {
203203
Condition,
204204
DependsOn: (RoleArn) ? undefined : `${LogicalName}Role`,
205205
Properties: {
206-
PolicyName: 'lambda-log-access',
206+
PolicyName: `${LogicalName}-lambda-log-access`,
207207
Roles: [roleName],
208208
PolicyDocument: {
209209
Version: '2012-10-17',

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/fixtures/shortcuts/event-lambda-custom-eventbus.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"Type": "AWS::IAM::Policy",
8888
"DependsOn": "MyLambdaRole",
8989
"Properties": {
90-
"PolicyName": "lambda-log-access",
90+
"PolicyName": "MyLambda-lambda-log-access",
9191
"Roles": [
9292
{
9393
"Ref": "MyLambdaRole"

test/fixtures/shortcuts/event-lambda-defaults.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"Type": "AWS::IAM::Policy",
8888
"DependsOn": "MyLambdaRole",
8989
"Properties": {
90-
"PolicyName": "lambda-log-access",
90+
"PolicyName": "MyLambda-lambda-log-access",
9191
"Roles": [
9292
{
9393
"Ref": "MyLambdaRole"

test/fixtures/shortcuts/event-lambda-full.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"Type": "AWS::IAM::Policy",
8888
"DependsOn": "MyLambdaRole",
8989
"Properties": {
90-
"PolicyName": "lambda-log-access",
90+
"PolicyName": "MyLambda-lambda-log-access",
9191
"Roles": [
9292
{
9393
"Ref": "MyLambdaRole"

test/fixtures/shortcuts/hookshot-github-compatible-legacy-node-runtimes.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
},
176176
"Handler": "index.lambda",
177177
"MemorySize": 128,
178-
"Runtime": "nodejs16.x",
178+
"Runtime": "nodejs22.x",
179179
"Timeout": 30,
180180
"Role": {
181181
"Fn::GetAtt": [
@@ -225,7 +225,7 @@
225225
"Type": "AWS::IAM::Policy",
226226
"DependsOn": "PassFunctionRole",
227227
"Properties": {
228-
"PolicyName": "lambda-log-access",
228+
"PolicyName": "PassFunction-lambda-log-access",
229229
"Roles": [
230230
{
231231
"Ref": "PassFunctionRole"
@@ -366,7 +366,7 @@
366366
"Type": "AWS::IAM::Policy",
367367
"DependsOn": "DestinationRole",
368368
"Properties": {
369-
"PolicyName": "lambda-log-access",
369+
"PolicyName": "Destination-lambda-log-access",
370370
"Roles": [
371371
{
372372
"Ref": "DestinationRole"

test/fixtures/shortcuts/hookshot-github-secret-ref.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
"Type": "AWS::IAM::Policy",
232232
"DependsOn": "PassFunctionRole",
233233
"Properties": {
234-
"PolicyName": "lambda-log-access",
234+
"PolicyName": "PassFunction-lambda-log-access",
235235
"Roles": [
236236
{
237237
"Ref": "PassFunctionRole"
@@ -372,7 +372,7 @@
372372
"Type": "AWS::IAM::Policy",
373373
"DependsOn": "DestinationRole",
374374
"Properties": {
375-
"PolicyName": "lambda-log-access",
375+
"PolicyName": "Destination-lambda-log-access",
376376
"Roles": [
377377
{
378378
"Ref": "DestinationRole"

test/fixtures/shortcuts/hookshot-github-secret-string.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
"Type": "AWS::IAM::Policy",
226226
"DependsOn": "PassFunctionRole",
227227
"Properties": {
228-
"PolicyName": "lambda-log-access",
228+
"PolicyName": "PassFunction-lambda-log-access",
229229
"Roles": [
230230
{
231231
"Ref": "PassFunctionRole"
@@ -366,7 +366,7 @@
366366
"Type": "AWS::IAM::Policy",
367367
"DependsOn": "DestinationRole",
368368
"Properties": {
369-
"PolicyName": "lambda-log-access",
369+
"PolicyName": "Destination-lambda-log-access",
370370
"Roles": [
371371
{
372372
"Ref": "DestinationRole"

test/fixtures/shortcuts/hookshot-github.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
"Type": "AWS::IAM::Policy",
234234
"DependsOn": "PassFunctionRole",
235235
"Properties": {
236-
"PolicyName": "lambda-log-access",
236+
"PolicyName": "PassFunction-lambda-log-access",
237237
"Roles": [
238238
{
239239
"Ref": "PassFunctionRole"
@@ -374,7 +374,7 @@
374374
"Type": "AWS::IAM::Policy",
375375
"DependsOn": "DestinationRole",
376376
"Properties": {
377-
"PolicyName": "lambda-log-access",
377+
"PolicyName": "Destination-lambda-log-access",
378378
"Roles": [
379379
{
380380
"Ref": "DestinationRole"

0 commit comments

Comments
 (0)