Closed bjhogan closed 1 year ago
Reproducible.
Possible fix:
Handle null
while iterating through managed policies at RoleHelper.CreateRole() and calling ExpandManagedPolicyName()
. Also handle null
while trying to attach policy later before trying to execute IamClient.AttachRolePolicyAsync().
Fixed in Amazon.Lambda.Tools version 5.4.5.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Describe the bug
When deploying a Lambda function using
dotnet lambda deploy-function
, an error occurs if the option No policy, add permissions later is chosen.Expected Behavior
The function deploys with a role that has no policy attached.
Current Behavior
Reproduction Steps
Create a Lambda function with the
lambda.EmptyFunction
template.Run
dotnet lambda deploy-function -fn SomeFunction
When asked to "Select IAM Role", choose Create new IAM Role . Enter a role name.
When asked to "Select IAM Policy to attach", choose No policy, add permissions later .
Exception occurs.
Possible Solution
Guard for null or empty
managedPolicy
in RoleHelper.csCreateRole(..)
Additional Information/Context
No response
Targeted .NET platform
.NET 6
CLI extension version
amazon.lambda.tools 5.4.4 dotnet-lambda (error output is from this version) amazon.lambda.tools 5.0.1 dotnet-lambda
Environment details (OS name and version, etc.)
Windows 10, Ubuntu 18.04