forked from itba-cloud/2023Q1-G7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
30 lines (24 loc) · 784 Bytes
/
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
resource "aws_lambda_function" "this" {
filename = var.lambda_info.filename
function_name = var.lambda_info.function_name
role = "arn:aws:iam::${var.account_id}:role/LabRole"
handler = var.lambda_info.handler
runtime = var.lambda_info.runtime
tags = {
name = "Lambda ${var.lambda_info.function_name}"
}
lifecycle {
create_before_destroy = true
}
vpc_config {
subnet_ids = var.subnet_ids
security_group_ids = var.sg_ids
}
}
resource "aws_lambda_permission" "this" {
statement_id = "AllowExecutionFromAPIGateway"
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.this.function_name
principal = "apigateway.amazonaws.com"
source_arn = "${var.apigw_execution_arn}/*"
}