Skip to content

Commit

Permalink
add use_default_security_group
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed Aug 21, 2024
1 parent adfba38 commit 10e967e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
locals {
security_group_ids = var.use_default_sg == true ? [data.aws_security_group.default[0].id] : var.security_group_ids
security_group_ids = var.use_default_security_group == true ? [data.aws_security_group.default[0].id] : var.security_group_ids
}

data "aws_security_group" "default" {
count = var.use_default_sg == true ? 1 : 0
name = "${terraform.workspace}-default-lambda-sg"
vpc_id = var.vpc_id
}
resource "aws_lambda_function" "lambda_function" {
s3_bucket = var.s3_bucket
Expand Down
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,15 @@ variable "architectures" {
variable "use_default_sg" {
description = "Whether to use the default security group for the Lambda function."
default = false
}

variable "vpc_id" {
description = "The VPC ID in which the Lambda runs"
default = ""
}

variable "use_default_security_group" {
type = bool
description = "Whether to use the default security group for the Lambda function."
default = false
}

0 comments on commit 10e967e

Please sign in to comment.