-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature]: lambda vpc_config and memory_size #301
Changes from all commits
2b3a561
7768b6c
8e406dd
97de336
a9d1334
3d75080
51946bb
88f8fce
d19d488
149593b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,17 @@ resource "aws_lambda_function" "lambda" { | |
} | ||
} | ||
|
||
dynamic "vpc_config" { | ||
for_each = var.vpc_config == null ? [] : [0] | ||
|
||
content { | ||
subnet_ids = var.vpc_config.subnet_ids | ||
security_group_ids = var.vpc_config.security_group_ids | ||
} | ||
} | ||
|
||
memory_size = var.memory_size | ||
|
||
tags = local.tags | ||
} | ||
|
||
|
@@ -110,3 +121,25 @@ resource "aws_iam_role_policy_attachment" "lambda_logs" { | |
role = aws_iam_role.role.name | ||
policy_arn = aws_iam_policy.lambda_logging.arn | ||
} | ||
|
||
// Execution role basic permissions | ||
data "aws_iam_policy_document" "role" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
statement { | ||
sid = "ec2" | ||
effect = "Allow" | ||
actions = [ | ||
"ec2:CreateNetworkInterface", | ||
"ec2:DescribeNetworkInterfaces", | ||
"ec2:DeleteNetworkInterface", | ||
] | ||
|
||
resources = [ | ||
"*", | ||
] | ||
} | ||
} | ||
|
||
resource "aws_iam_role_policy" "role" { | ||
role = aws_iam_role.role.name | ||
policy = data.aws_iam_policy_document.role.json | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,19 @@ variable "reserved_concurrent_executions" { | |
description = "Set reserved_concurrent_executions for this function. See [docs](https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html)." | ||
default = -1 // aws default | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
variable "vpc_config" { | ||
type = object({ | ||
subnet_ids = list(string), | ||
security_group_ids = list(string) | ||
}) | ||
|
||
description = "The lambda's vpc configuration" | ||
default = null | ||
} | ||
|
||
variable "memory_size" { | ||
type = number | ||
description = "Amount of memory to allocate to the lambda" | ||
default = 128 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Single line comments should begin with #