-
Notifications
You must be signed in to change notification settings - Fork 0
/
invoke.tf
32 lines (26 loc) · 876 Bytes
/
invoke.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
# Initialize a channel renewer for each desired app
resource "aws_lambda_invocation" "init" {
for_each = toset(var.applications)
function_name = aws_lambda_function.channeler.function_name
qualifier = aws_lambda_alias.channeler.name
input = jsonencode({
application = each.value
lambda_action = "init"
})
depends_on = [time_sleep.wait]
}
# Stop a channel renewer for each desired app
resource "aws_lambda_invocation" "stop" {
for_each = toset(var.stop_applications)
function_name = aws_lambda_function.channeler.function_name
qualifier = aws_lambda_alias.channeler.name
input = jsonencode({
application = each.value
lambda_action = "stop"
})
}
# wait a few seconds for necessary policy to propagate
resource "time_sleep" "wait" {
depends_on = [aws_iam_role_policy.channeler]
create_duration = "10s"
}