1
- data "archive_file" "helloWorldLambdaZip" {
2
- type = " zip"
3
- source_dir = " functions/helloWorldLambda"
4
- output_path = " output/helloWorldLambda.zip"
5
- }
6
-
7
- resource "aws_lambda_function" "schibbler_helloWorldLambda" {
8
- filename = " output/helloWorldLambda.zip"
9
- source_code_hash = " ${ data . archive_file . helloWorldLambdaZip . output_base64sha256 } "
10
- function_name = " schibblerhelloWorldLambda"
11
- handler = " index.handler"
12
- role = " ${ aws_iam_role . helloWorldLambda . arn } "
13
- runtime = " nodejs8.10"
14
- }
15
-
16
1
data "aws_iam_policy_document" "helloWorldLambda_policy" {
17
2
statement {
18
3
actions = [" sts:AssumeRole" ]
@@ -30,12 +15,26 @@ resource "aws_iam_role" "helloWorldLambda" {
30
15
assume_role_policy = " ${ data . aws_iam_policy_document . helloWorldLambda_policy . json } "
31
16
}
32
17
33
-
34
18
resource "aws_iam_role_policy_attachment" "helloWorldLambda_policyAttachment" {
35
19
role = " ${ aws_iam_role . helloWorldLambda . name } "
36
20
policy_arn = " arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
37
21
}
38
22
23
+ data "archive_file" "helloWorldLambdaZip" {
24
+ type = " zip"
25
+ source_dir = " functions/helloWorldLambda"
26
+ output_path = " output/helloWorldLambda.zip"
27
+ }
28
+
29
+ resource "aws_lambda_function" "schibbler_helloWorldLambda" {
30
+ filename = " output/helloWorldLambda.zip"
31
+ source_code_hash = " ${ data . archive_file . helloWorldLambdaZip . output_base64sha256 } "
32
+ function_name = " schibblerhelloWorldLambda"
33
+ handler = " index.handler"
34
+ role = " ${ aws_iam_role . helloWorldLambda . arn } "
35
+ runtime = " nodejs8.10"
36
+ }
37
+
39
38
resource "aws_api_gateway_resource" "helloWorld" {
40
39
rest_api_id = " ${ aws_api_gateway_rest_api . helloWorldGateway . id } "
41
40
parent_id = " ${ aws_api_gateway_rest_api . helloWorldGateway . root_resource_id } "
0 commit comments