forked from binhoul/terraform-aws-lambda-exec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
47 lines (42 loc) · 1.04 KB
/
main.tf
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# ---------------------------------------------------------------------------------------------------------------------
# EXECUTE A LAMBDA IN AWS
# ---------------------------------------------------------------------------------------------------------------------
terraform {
required_version = ">=0.12"
}
resource "aws_cloudformation_stack" "execute_lambda" {
count = var.amount
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("", ["Custom", "::", var.custom_name])}",
"Properties":
${jsonencode(
merge(
{
"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
}