Skip to content

Commit 6758ef2

Browse files
authored
Merge pull request #19 from greyshi/main
docs: fix inaccuracies and points of confusion in docs and examples
2 parents adf3041 + 27b607b commit 6758ef2

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ jobs:
5555
with:
5656
function-name: my-function-name
5757
code-artifacts-dir: my-code-artifacts-dir
58-
# handler: my-handler
59-
# runtime: my-runtime
58+
handler: index.handler
59+
runtime: nodejs22.x
6060
# Add any additional inputs this action supports
6161
```
6262

63-
The required parameters to deploy are `function-name` and `code-artifacts-dir`. If a function with the name specified by `function-name` does not exist, it will be created with the provided code within `code-artifacts-dir` and configuration parameters using the [CreateFunction](https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunction.html) API.
64-
65-
Handler and runtime default to index.handler and nodejs20.x but can be customized. For the full list of inputs this GitHub Action supports, see [Inputs](#inputs).
63+
The required parameters to deploy are `function-name`, `code-artifacts-dir`, `handler`, and `runtime`. If the function does not exist yet, the `role` parameter is also required to specify the function's IAM execution role.
6664

65+
If a function with the name specified by `function-name` does not exist, it will be created with the provided code within `code-artifacts-dir` and configuration parameters using the [CreateFunction](https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunction.html) API.
6766

67+
For the full list of inputs this GitHub Action supports, see [Inputs](#inputs).
6868

6969
### Update Function Configuration
7070
Function configuration will be updated using the [UpdateFunctionConfiguration](https://docs.aws.amazon.com/lambda/latest/api/API_UpdateFunctionConfiguration.html) API if configuration values differ from the deployed Lambda function's configuration.
@@ -229,13 +229,23 @@ This action requires the following minimum set of permissions:
229229
"Sid": "LambdaDeployPermissions",
230230
"Effect": "Allow",
231231
"Action": [
232-
"lambda:GetFunction",
232+
"lambda:GetFunctionConfiguration",
233233
"lambda:CreateFunction",
234234
"lambda:UpdateFunctionCode",
235235
"lambda:UpdateFunctionConfiguration",
236236
"lambda:PublishVersion"
237237
],
238238
"Resource": "arn:aws:lambda:<region>:<aws_account_id>:function:<function_name>"
239+
},
240+
{
241+
"Sid":"PassRolesDefinition",
242+
"Effect":"Allow",
243+
"Action":[
244+
"iam:PassRole"
245+
],
246+
"Resource":[
247+
"arn:aws:iam::<aws_account_id>:role/<function_execution_role_name>"
248+
]
239249
}
240250
]
241251
}

deploy-lambda-example.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# - Create a new role with Web Identity as the trusted entity
1414
# - Select the OIDC provider you created above
1515
# - For "Audience", enter "sts.amazonaws.com"
16-
# - Add a condition to limit the role to your repository:
16+
# - Add a condition to limit the role to your repository:
1717
# token.actions.githubusercontent.com:sub: repo:your-org/your-repo:*
1818
# - Attach policies for Lambda and S3 permissions (Can be found on the README.md)
1919
#
@@ -23,7 +23,7 @@
2323
# - LAMBDA_FUNCTION_NAME
2424
# - LAMBDA_CODE_ARTIFACTS_DIR
2525
# - LAMBDA_HANDLER
26-
# - LAMBDA_RUNTIME
26+
# - LAMBDA_RUNTIME
2727
#
2828
# 4. Add any additional parameters under the environment variable section and Deploy Lambda Function step.
2929
#
@@ -47,6 +47,7 @@ env:
4747
LAMBDA_CODE_ARTIFACTS_DIR: MY_CODE_ARTIFACTS_DIR # set this to the directory containing your Lambda code
4848
LAMBDA_HANDLER: MY_LAMBDA_HANDLER # set this to your Lambda handler
4949
LAMBDA_RUNTIME: MY_LAMBDA_RUNTIME # set this to your Lambda runtime
50+
LAMBDA_EXECUTION_ROLE: MY_LAMBDA_EXECUTION_ROLE # set this to your function's IAM execution role
5051
# Include additional parameters as needed (Format at LAMBDA_PARAMETER)
5152

5253
permissions:
@@ -74,7 +75,8 @@ jobs:
7475
uses: aws-actions/aws-lambda-deploy@v1
7576
with:
7677
function-name: ${{ env.LAMBDA_FUNCTION_NAME }}
77-
code-artifacts-dir: ${{ env.CODE_ARTIFACTS_DIR }}
78+
code-artifacts-dir: ${{ env.LAMBDA_CODE_ARTIFACTS_DIR }}
7879
handler: ${{ env.LAMBDA_HANDLER }}
7980
runtime: ${{ env.LAMBDA_RUNTIME }}
81+
role: ${{ env.LAMBDA_EXECUTION_ROLE }}
8082
# Add any additional inputs your action supports

0 commit comments

Comments
 (0)