Skip to content

Commit

Permalink
Lambda VPC config (#5)
Browse files Browse the repository at this point in the history
* lambda vpc subnets and security groups configuration added
  • Loading branch information
lukaspour authored Jun 30, 2020
1 parent ebdee75 commit eca07e8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ife-lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ resource "aws_lambda_function" "ife_lambda_authorizer" {
}

tags = var.tags

vpc_config {
subnet_ids = var.lambda_subnet_ids
security_group_ids = var.lambda_security_group_ids
}
}
15 changes: 14 additions & 1 deletion ife-lambda/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,17 @@ variable "tags" {
description = "A map of tags to add to all resources"
type = map(string)
default = {}
}
}

variable "lambda_subnet_ids" {
description = "VPC subnets for Lambda"
type = list(string)
default = []
}

variable "lambda_security_group_ids" {
description = "SG IDs for Lambda, should at least allow all outbound"
type = list(string)
default = []
}

9 changes: 6 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ module "ife_authorization_lambda" {
env_user_pool_id = module.ife_cognito.cognito_pool_id
param_store_client_prefix = local.param_store_client_prefix

lambda_log_retention = local.lambda_log_retention
tags = local.tags
lambda_log_retention = local.lambda_log_retention
lambda_subnet_ids = var.lambda_subnet_ids
lambda_security_group_ids = var.lambda_security_group_ids

tags = local.tags
}


Expand All @@ -87,4 +90,4 @@ module "ife_api_gateway" {
custom_sub_domain = local.api_sub_domain

tags = local.tags
}
}
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,16 @@ variable "lambda_log_retention" {
type = number
default = 30
}

variable "lambda_subnet_ids" {
description = "VPC subnets for Lambda"
type = list(string)
default = []
}

variable "lambda_security_group_ids" {
description = "SG IDs for Lambda, should at least allow all outbound"
type = list(string)
default = []
}

0 comments on commit eca07e8

Please sign in to comment.