Skip to content

Commit

Permalink
Merge 167ae5b into 07d355b
Browse files Browse the repository at this point in the history
  • Loading branch information
ldcorentin committed Mar 23, 2023
2 parents 07d355b + 167ae5b commit 0239d82
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
40 changes: 40 additions & 0 deletions terraform/module/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ resource "aws_lambda_function" "analyzer" {

runtime = "nodejs16.x"

dynamic "vpc_config" {
for_each = var.vpc_subnet_ids != null && var.vpc_security_group_ids != null ? [true] : []
content {
security_group_ids = var.vpc_security_group_ids
subnet_ids = var.vpc_subnet_ids
}
}

environment {
variables = {
defaultPowerValues = local.defaultPowerValues,
Expand Down Expand Up @@ -44,6 +52,14 @@ resource "aws_lambda_function" "cleaner" {

runtime = "nodejs16.x"

dynamic "vpc_config" {
for_each = var.vpc_subnet_ids != null && var.vpc_security_group_ids != null ? [true] : []
content {
security_group_ids = var.vpc_security_group_ids
subnet_ids = var.vpc_subnet_ids
}
}

environment {
variables = {
defaultPowerValues = local.defaultPowerValues,
Expand Down Expand Up @@ -73,6 +89,14 @@ resource "aws_lambda_function" "executor" {

runtime = "nodejs16.x"

dynamic "vpc_config" {
for_each = var.vpc_subnet_ids != null && var.vpc_security_group_ids != null ? [true] : []
content {
security_group_ids = var.vpc_security_group_ids
subnet_ids = var.vpc_subnet_ids
}
}

environment {
variables = {
defaultPowerValues = local.defaultPowerValues,
Expand Down Expand Up @@ -102,6 +126,14 @@ resource "aws_lambda_function" "initializer" {

runtime = "nodejs16.x"

dynamic "vpc_config" {
for_each = var.vpc_subnet_ids != null && var.vpc_security_group_ids != null ? [true] : []
content {
security_group_ids = var.vpc_security_group_ids
subnet_ids = var.vpc_subnet_ids
}
}

environment {
variables = {
defaultPowerValues = local.defaultPowerValues,
Expand Down Expand Up @@ -131,6 +163,14 @@ resource "aws_lambda_function" "optimizer" {

runtime = "nodejs16.x"

dynamic "vpc_config" {
for_each = var.vpc_subnet_ids != null && var.vpc_security_group_ids != null ? [true] : []
content {
security_group_ids = var.vpc_security_group_ids
subnet_ids = var.vpc_subnet_ids
}
}

environment {
variables = {
defaultPowerValues = local.defaultPowerValues,
Expand Down
12 changes: 12 additions & 0 deletions terraform/module/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,15 @@ variable "permissions_boundary" {
default = null
description = "ARN of the policy that is used to set the permissions boundary for the role."
}

variable "vpc_subnet_ids" {
description = "List of subnet ids when Lambda Function should run in the VPC. Usually private or intra subnets."
type = list(string)
default = null
}

variable "vpc_security_group_ids" {
description = "List of security group ids when Lambda Function should run in the VPC."
type = list(string)
default = null
}

0 comments on commit 0239d82

Please sign in to comment.