Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Make lambda permission statement id unique across rest/http gateway #259

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pkg/infra/pulumi_aws/iac/api_gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,16 @@ export class ApiGateway {
return new aws.lambda.Permission(
`${gwName}-${verb}-${path}`,
{
statementId: `${gwName}-${verb}-${r.path.replace(/[^a-zA-Z0-9]+/g, '-')}`,
statementId: `${gwName}-http-${verb}-${r.path.replace(/[^a-zA-Z0-9]+/g, '-')}`,
action: 'lambda:InvokeFunction',
function: lambda,
principal: 'apigateway.amazonaws.com',
sourceArn: pulumi.interpolate`arn:aws:execute-api:${this.lib.region}:${this.accountId}:${resourceId}`,
},
{ parent: lambda }
{
dependsOn: [api],
parent: lambda,
}
)
}

Expand Down Expand Up @@ -495,7 +498,7 @@ export class ApiGateway {
new aws.lambda.Permission(
`${r.execUnitName}-${r.verb}-${r.path}-permission`,
{
statementId: `${gwName}-${r.verb}-${r.path.replace(
statementId: `${gwName}-rest-${r.verb}-${r.path.replace(
/[^a-zA-Z0-9]/g,
'-'
)}`,
Expand All @@ -508,7 +511,10 @@ export class ApiGateway {
r.verb.toUpperCase() === 'ANY' ? '*' : r.verb.toUpperCase()
}${parentResource == null ? '/' : parentResource.path}`,
},
{ parent: lambda }
{
dependsOn: [restAPI],
parent: lambda,
}
)
)
}
Expand Down