Skip to content

Commit

Permalink
feat: add vpc_config
Browse files Browse the repository at this point in the history
Signed-off-by: nitrocode <[email protected]>
  • Loading branch information
nitrocode committed Sep 5, 2024
1 parent 5cb1ecd commit ab0cb2a
Show file tree
Hide file tree
Showing 17 changed files with 172 additions and 0 deletions.
8 changes: 8 additions & 0 deletions terraform-modules/lambda-cloudflare/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda-cloudflare/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ variable "bugcrowd_state" {}
variable "hackerone" {}
variable "hackerone_api_token" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "state_machine_arn" {
default = ""
}
Expand Down
8 changes: 8 additions & 0 deletions terraform-modules/lambda-resources/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda-resources/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ variable "sns_topic_arn" {}
variable "dlq_sns_topic_arn" {}
variable "lambdas" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "state_machine_arn" {
default = ""
}
Expand Down
8 changes: 8 additions & 0 deletions terraform-modules/lambda-scan-ips/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda-scan-ips/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ variable "bugcrowd_state" {}
variable "hackerone" {}
variable "hackerone_api_token" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "timeout" {
description = "Amount of time your Lambda Function has to run in seconds"
default = 900
Expand Down
8 changes: 8 additions & 0 deletions terraform-modules/lambda-scan/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda-scan/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ variable "bugcrowd_state" {}
variable "hackerone" {}
variable "hackerone_api_token" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "timeout" {
description = "Amount of time your Lambda Function has to run in seconds"
default = 900
Expand Down
8 changes: 8 additions & 0 deletions terraform-modules/lambda-slack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda-slack/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ variable "slack_fix_emoji" {}
variable "slack_new_emoji" {}
variable "slack_username" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "timeout" {
description = "Amount of time your Lambda Function has to run in seconds"
default = 900
Expand Down
8 changes: 8 additions & 0 deletions terraform-modules/lambda-stats/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda-stats/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ variable "org_primary_account" {}
variable "security_audit_role_name" {}
variable "external_id" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "timeout" {
description = "Amount of time your Lambda Function has to run in seconds"
default = 900
Expand Down
8 changes: 8 additions & 0 deletions terraform-modules/lambda-takeover/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda-takeover/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ variable "memory_size" {}
variable "sns_topic_arn" {}
variable "dlq_sns_topic_arn" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "timeout" {
description = "Amount of time your Lambda Function has to run in seconds"
default = 900
Expand Down
8 changes: 8 additions & 0 deletions terraform-modules/lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ resource "aws_lambda_function" "lambda" {
tracing_config {
mode = "Active"
}

dynamic "vpc_config" {
for_each = var.vpc_config != null ? [var.vpc_config] : []
content {
security_group_ids = vpc_config.value.security_group_ids
subnet_ids = vpc_config.value.subnet_ids
}
}
}

resource "aws_lambda_alias" "lambda" {
Expand Down
12 changes: 12 additions & 0 deletions terraform-modules/lambda/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ variable "dlq_sns_topic_arn" {}
variable "allowed_regions" {}
variable "ip_time_limit" {}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

variable "timeout" {
description = "Amount of time your Lambda Function has to run in seconds"
default = 900
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,15 @@ variable "permissions_boundary_arn" {
default = null
type = string
}

variable "vpc_config" {
type = object({
security_group_ids = list(string)
subnet_ids = list(string)
})
description = <<EOF
Provide this to allow your function to access your VPC (if both 'subnet_ids' and 'security_group_ids' are empty then
vpc_config is considered to be empty or unset, see https://docs.aws.amazon.com/lambda/latest/dg/vpc.html for details).
EOF
default = null
}

0 comments on commit ab0cb2a

Please sign in to comment.