-
-
Notifications
You must be signed in to change notification settings - Fork 716
fix: Add .NET 8 runtime example #685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add .NET 8 runtime example #685
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to run it on the Mac where dotnet has never existed before. brew install --cask dotnet
executed successfully. What else should be installed? Maybe update the README.md or issue desciption.
│ RuntimeError: Script did not run successfully, exit code 1: - The command could not be loaded, possibly because:
│ * You intended to execute a .NET application:
│ The application 'publish' does not exist.
│ * You intended to execute a .NET SDK command:
│ No .NET SDKs were found.
│
│ Download a .NET SDK:
│ https://aka.ms/dotnet/download
│
│ Learn about SDK resolution:
│ https://aka.ms/dotnet/sdk-not-found
Oh god, this is embarrassing — I totally had the wrong instructions 🤦 The correct command to install .NET is @antonbabenko can you run a My apologies! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works!
d5c657c
into
terraform-aws-modules:master
## [7.21.1](v7.21.0...v7.21.1) (2025-06-19) ### Bug Fixes * Add .NET 8 runtime example ([#685](#685)) ([d5c657c](d5c657c))
This PR is included in version 7.21.1 🎉 |
Thank you for adding the example for the .NET runtime! |
Thank you for all your work on these awesome modules ❣️ |
Description
Added documentation for how this module can be used to deploy a tiny .NET 8 Lambda function.
Motivation and Context
TL;DR: Python annoyed me so much I decided to move to .NET 😅 Just like with Python, there are 30 different ways to package a .NET Lambda — this PR adds a super-simple
dotnet8
example. To run thisbrew install --cask dotnet-sdk
will probably be needed.Late last year, after getting annoyed for the millionth time with Python's packaging (yes, I know uv and Flox exist), I decided to start moving some Lambdas to .NET. I was surprised to see no docs for how to use this module to deploy a
dotnet8
Lambda — no examples, no issues, no discussions, no anything. Yesterday I finally remembered to create this Pull Request to update the docs 🙂Just like with Python, there are a ton of ways to package a .NET Lambda:
dotnet publish
dotnet lambda package
sam package
For all the above, of course, there are even more options:
dotnet8
(either.zip
or container Lambdas),dotnet9
(container Lambdas only), or even custom runtimesIn addition to me not having any idea how to do most of the above and in addition to me failing to do some of the above things (
dotnet lambda package
generates azip
already and getting that to play nicely with thepackage.py
script from this module was... too much for me), adding all that would've been confusing and unnecessary. Plus, you know, a lot of code that would have had to be maintained and updated.Finally I decided to add the most minimal example I could think of: a .NET8 Lambda using top-level statements (i.e. no classes and no factories and no 10 different
.cs
files) that's straightforward packaged in a.zip
and ran using the AWS-maintained-and-manageddotnet8
runtime.To actually run this, folks will need to install
dotnet
on their machines: either using the .NET installer or with Homebrew by runningbrew install --cask dotnet-sdk
. The latest version of .NET should be installed (currently latest stable is 9 and latest long-term support is 8) as it can build packages for a lot of targets: from way beforedotnet5
and all the way todotnet9
.Breaking Changes
No breaking change for users of the module since this is a docs-only change.
For developers working on this module that want to run the
examples/runtimes
code,dotnet
will have to be installed.How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull requestI also ran a
terraform apply
and confirmed the .NET 8 Lambda function was correctly created and that it was working. I commented out the other runtimes as I did not have the dependencies installed and I am ignoring the warning caused by the newly-released v6.0.0 of the AWS Terraform Provider:Let me know if there's anything I missed or if I should change anything!