Skip to content

Commit

Permalink
updated with KW comments
Browse files Browse the repository at this point in the history
  • Loading branch information
haitchison committed Jan 4, 2024
1 parent d443407 commit e633a66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions test/unit-test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ data "aws_iam_policy_document" "instance-scheduler-lambda-function-policy" {
resource "aws_lambda_invocation" "test_invocation" {
function_name = module.module_test.lambda_function_name

input = jsonencode(
{
input = jsonencode({
action = "Test"
})
}
Expand All @@ -162,16 +161,16 @@ resource "aws_lambda_invocation" "test_invocation" {
module "lambda_function_in_vpc" {
source = "../../"
application_name = local.application_name
tags = local.tags
description = "lambda function provisioned within a vpc test"
lambda_role = aws_iam_role.lambda-vpc-role.arn
function_name = format("lambda-function-in-vpc-test-%s", random_id.lambda_name.dec)
create_role = false
package_type = "Zip"
filename = data.archive_file.lambda-zip.output_path
source_code_hash = data.archive_file.lambda-zip.output_base64sha256
handler = "test.lambda_handler"
runtime = "python3.8"
tags = local.tags
function_name = format("lambda-function-in-vpc-test-%s", random_id.lambda_name.dec)
create_role = false
lambda_role = aws_iam_role.lambda-vpc-role.arn

vpc_subnet_ids = [data.aws_subnet.private-2a.id]
vpc_security_group_ids = [aws_security_group.lambda_security_group_test.id]
Expand Down Expand Up @@ -213,15 +212,14 @@ resource "aws_security_group" "lambda_security_group_test" {
name = format("lambda-vpc-module-test-%s", random_id.sg_name.dec)
description = "lambda attached to vpc test security group"
vpc_id = data.aws_vpc.platforms-test.id

tags = local.tags

egress {
description = "Allow all outbound traffic"
from_port = 0
to_port = 0
protocol = "-1"
}

tags = local.tags
}

data "archive_file" "lambda-zip" {
Expand All @@ -233,8 +231,7 @@ data "archive_file" "lambda-zip" {
resource "aws_lambda_invocation" "test_vpc_invocation" {
function_name = module.lambda_function_in_vpc.lambda_function_name

input = jsonencode(
{
input = jsonencode({
action = "Test"
})
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit-test/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ output "function_vpc_name" {

output "vpc_result_code" {
value = aws_lambda_invocation.test_vpc_invocation.result
}
}

0 comments on commit e633a66

Please sign in to comment.