cdklabs / cdklabs/awscdk-lambda-dotnet
Please add DotNetTriggerFunction
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 4
- Avg merge
- 23m
- Merged PRs (30d)
- 4
Description
I use DotNetFunction in my CDK app instead of the normal Function, so that my Lambda function is packaged during synthesis without manually calling `dotnet lambda package ...`.
However, CDK also has a TriggerFunction which runs during deployment. For example:
```
var initDatabaseFunction = new TriggerFunction(this, "InitDatabase", new TriggerFunctionProps()
{
Runtime = Runtime.DOTNET_8,
Vpc = props.Vpc,
VpcSubnets = new SubnetSelection()
{
SubnetGroupName = "Database",
},
//NOTE: need to call "dotnet lambda package" to create this ZIP file
Code = Code.FromAsset("../functions/DatabaseInitFunction/bin/Release/net8.0/DatabaseInitFunction.zip"),
Handler = "DatabaseInitFunction",
Timeout = Duration.Minutes(5),
Environment = new Dictionary()
{
{ "VpcCidr", props.Vpc.VpcCidrBlock},
{ "Secret" , props.DatabaseCluster.Secret.SecretName }
},
SecurityGroups = new SecurityGroup[] {securityGroup},
});
```
It would be useful to have a similar DotNetTriggerFunction (or TriggerDotNetFunction?) like this:
```
var initDatabaseFunction = new DotNetTriggerFunction(this, "InitDatabase", new TriggerFunctionProps()
{
Runtime = Runtime.DOTNET_8,
Vpc = props.Vpc,
VpcSubnets = new SubnetSelection()
{
SubnetGroupName = "Database",
},
ProjectDir = "../functions/DatabaseInitFunction",
Handler = "DatabaseInitFunction",
Timeout = Duration.Minutes(5),
Environment = new Dictionary()
{
{ "VpcCidr", props.Vpc.VpcCidrBlock},
{ "Secret" , props.DatabaseCluster.Secret.SecretName }
},
SecurityGroups = new SecurityGroup[] {securityGroup},
});
```
Contributor guide
Assessment
This issue has not been assessed yet.