Skip to content

Commit

Permalink
feat: vpc config functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
haitchison committed Dec 14, 2023
1 parent 5a3c02a commit 36aa71f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ resource "aws_lambda_function" "this" { #tfsec:ignore:aws-lambda-enable-tracing
variables = var.environment_variables
}
}
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
}
}
}

resource "aws_lambda_permission" "allowed_triggers" {
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,15 @@ variable "sns_topic_on_success" {
type = string
default = ""
}

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 36aa71f

Please sign in to comment.