Please add DotNetTriggerFunction

Open
#438 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
aws, csharp, typescript
Domain
backend, cloud

Research direction

Start by comparing the existing DotNetFunction construct with the CDK TriggerFunction API and its TriggerFunctionProps usage shown in the issue. Implement the analogous DotNetTriggerFunction with ProjectDir-based packaging while preserving trigger configuration such as VPC, handler, timeout, environment, and security groups; done means the example no longer requires manually creating a ZIP before deployment.

Written by the indexing model from the issue text.

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<string,string>()
                {
                    { "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<string,string>()
             {
                 { "VpcCidr", props.Vpc.VpcCidrBlock},
                 { "Secret" , props.DatabaseCluster.Secret.SecretName }
             },
             SecurityGroups = new SecurityGroup[] {securityGroup},
         });
Dominant language
TypeScript
Stars
7
Forks
4
Avg merge
8h 23m
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cdklabs/awscdk-lambda-dotnet

All issues in cdklabs/awscdk-lambda-dotnet

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.