forked from connect-group/terraform-aws-lambda-exec
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.tf
More file actions
30 lines (27 loc) · 1 KB
/
main.tf
File metadata and controls
30 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# ---------------------------------------------------------------------------------------------------------------------
# EXECUTE A LAMBDA IN AWS
# ---------------------------------------------------------------------------------------------------------------------
terraform {
required_version = ">=0.9.2"
}
resource "aws_cloudformation_stack" "execute_lambda" {
count = "${var.count}"
name = "${var.name}"
tags = "${var.tags}"
timeout_in_minutes = "${var.timeout_in_minutes}"
template_body = <<EOF
{
"Description" : "Execute a Lambda and return the results",
"Resources": {
"${var.custom_name}": {
"Type": "${join("", list("Custom", "::", var.custom_name))}",
"Properties":
${jsonencode(merge(map("ServiceToken",var.lambda_function_arn), var.lambda_inputs))}
}
},
"Outputs": {
${join(",", formatlist("\"%s\":{\"Value\": {\"Fn::GetAtt\":[\"%s\", \"%s\"]}}", var.lambda_outputs, var.custom_name,var.lambda_outputs))}
}
}
EOF
}