Skip to content
This repository was archived by the owner on Apr 3, 2022. It is now read-only.

Commit 428152d

Browse files
committed
Automated setup
1 parent 90e8b17 commit 428152d

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

terraform/get_hello.tf

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
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-
161
data "aws_iam_policy_document" "helloWorldLambda_policy" {
172
statement {
183
actions = ["sts:AssumeRole"]
@@ -30,12 +15,26 @@ resource "aws_iam_role" "helloWorldLambda" {
3015
assume_role_policy = "${data.aws_iam_policy_document.helloWorldLambda_policy.json}"
3116
}
3217

33-
3418
resource "aws_iam_role_policy_attachment" "helloWorldLambda_policyAttachment" {
3519
role = "${aws_iam_role.helloWorldLambda.name}"
3620
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
3721
}
3822

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+
3938
resource "aws_api_gateway_resource" "helloWorld" {
4039
rest_api_id = "${aws_api_gateway_rest_api.helloWorldGateway.id}"
4140
parent_id = "${aws_api_gateway_rest_api.helloWorldGateway.root_resource_id}"

0 commit comments

Comments
 (0)