diff --git a/.github/labeler.yaml b/.github/labeler.yaml
index 9285ab9..936fa7d 100644
--- a/.github/labeler.yaml
+++ b/.github/labeler.yaml
@@ -17,6 +17,9 @@
":floppy_disk: lattice-ip-target-group":
- modules/lattice-ip-target-group/**/*
+":floppy_disk: lattice-lambda-target-group":
+- modules/lattice-lambda-target-group/**/*
+
":floppy_disk: lattice-service-listener":
- modules/lattice-service-listener/**/*
diff --git a/.github/labels.yaml b/.github/labels.yaml
index 3563d86..b2a1a4b 100644
--- a/.github/labels.yaml
+++ b/.github/labels.yaml
@@ -58,6 +58,9 @@
- color: "fbca04"
description: "This issue or pull request is related to lattice-ip-target-group module."
name: ":floppy_disk: lattice-ip-target-group"
+- color: "fbca04"
+ description: "This issue or pull request is related to lattice-lambda-target-group module."
+ name: ":floppy_disk: lattice-lambda-target-group"
- color: "fbca04"
description: "This issue or pull request is related to lattice-service-listener module."
name: ":floppy_disk: lattice-service-listener"
diff --git a/README.md b/README.md
index 965629d..2c8f100 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Terraform module which creates VPC Connectivity related resources (VPC Peering,
- [lattice-alb-target-group](./modules/lattice-alb-target-group)
- [lattice-instance-target-group](./modules/lattice-instance-target-group)
- [lattice-ip-target-group](./modules/lattice-ip-target-group)
+- [lattice-lambda-target-group](./modules/lattice-lambda-target-group)
- [lattice-service-listener](./modules/lattice-service-listener)
- [lattice-service-network](./modules/lattice-service-network)
- [lattice-service](./modules/lattice-service)
@@ -42,6 +43,7 @@ Terraform Modules from [this package](https://github.com/tedilabs/terraform-aws-
- ALB Target Group
- Instance Target Group
- IP Target Group
+ - Lambda Target Group
- **AWS DX (Direct Connect)**
- Connection
- Gateway
@@ -61,6 +63,7 @@ Terraform Modules from [this package](https://github.com/tedilabs/terraform-aws-
- [lattice-alb-target-group](./examples/lattice-alb-target-group)
- [lattice-instance-target-group](./examples/lattice-instance-target-group)
- [lattice-ip-target-group](./examples/lattice-ip-target-group)
+- [lattice-lambda-target-group](./examples/lattice-lambda-target-group)
### Network Manager
diff --git a/examples/lattice-lambda-target-group/function/index.py b/examples/lattice-lambda-target-group/function/index.py
new file mode 100644
index 0000000..396c505
--- /dev/null
+++ b/examples/lattice-lambda-target-group/function/index.py
@@ -0,0 +1,4 @@
+def lambda_handler(event, context):
+ print("Hello from app1!")
+
+ return event
diff --git a/examples/lattice-lambda-target-group/lambda.tf b/examples/lattice-lambda-target-group/lambda.tf
new file mode 100644
index 0000000..3dc4fd1
--- /dev/null
+++ b/examples/lattice-lambda-target-group/lambda.tf
@@ -0,0 +1,19 @@
+###################################################
+# Lambda Function
+###################################################
+
+module "lambda_function" {
+ source = "terraform-aws-modules/lambda/aws"
+ version = "~> 6.0.0"
+
+ publish = true
+
+ function_name = "lambda-function-for-vpc-lattice"
+ source_path = "${path.root}/function/"
+ handler = "index.lambda_handler"
+ runtime = "python3.8"
+
+ tags = {
+ "project" = "terraform-aws-vpc-connectivity-examples"
+ }
+}
diff --git a/examples/lattice-lambda-target-group/main.tf b/examples/lattice-lambda-target-group/main.tf
new file mode 100644
index 0000000..7a9f5bd
--- /dev/null
+++ b/examples/lattice-lambda-target-group/main.tf
@@ -0,0 +1,30 @@
+provider "aws" {
+ region = "us-east-1"
+}
+
+
+###################################################
+# Lambda Target Group
+###################################################
+
+module "target_group" {
+ source = "../../modules/lattice-lambda-target-group"
+ # source = "tedilabs/vpc-connectivity/aws//modules/lattice-lambda-target-group"
+ # version = "~> 0.2.0"
+
+ name = "lambda-hello"
+
+
+ ## Targets
+ targets = [
+ {
+ name = "lambda-function-for-vpc-lattice"
+ lambda_function = module.lambda_function.lambda_function_arn
+ }
+ ]
+
+
+ tags = {
+ "project" = "terraform-aws-vpc-connectivity-examples"
+ }
+}
diff --git a/examples/lattice-lambda-target-group/outputs.tf b/examples/lattice-lambda-target-group/outputs.tf
new file mode 100644
index 0000000..57f0dc5
--- /dev/null
+++ b/examples/lattice-lambda-target-group/outputs.tf
@@ -0,0 +1,9 @@
+output "target_group" {
+ description = "The ALB target group of VPC Lattice."
+ value = module.target_group
+}
+
+output "lambda_function" {
+ description = "The Lambda function for VPC Lattice."
+ value = module.lambda_function
+}
diff --git a/examples/lattice-lambda-target-group/versions.tf b/examples/lattice-lambda-target-group/versions.tf
new file mode 100644
index 0000000..59c42e8
--- /dev/null
+++ b/examples/lattice-lambda-target-group/versions.tf
@@ -0,0 +1,10 @@
+terraform {
+ required_version = "~> 1.5"
+
+ required_providers {
+ aws = {
+ source = "hashicorp/aws"
+ version = "~> 5.0"
+ }
+ }
+}
diff --git a/modules/lattice-alb-target-group/README.md b/modules/lattice-alb-target-group/README.md
index 33f7d77..138ba53 100644
--- a/modules/lattice-alb-target-group/README.md
+++ b/modules/lattice-alb-target-group/README.md
@@ -61,6 +61,6 @@ This module creates following resources.
| [protocol\_version](#output\_protocol\_version) | The protocol version. |
| [status](#output\_status) | The status of the target group. |
| [targets](#output\_targets) | The list of targets of the target group.
`name` - The name of the target. This value is only used internally within Terraform code.
`alb` - The Amazon Resource Name (ARN) of the target ALB (Application Load Balancer).
`port` - The port on which the target is listening. |
-| [type](#output\_type) | The type of target group. Always `IP`. |
+| [type](#output\_type) | The type of target group. Always `ALB`. |
| [vpc](#output\_vpc) | The ID of the VPC which the target group belongs to. |
diff --git a/modules/lattice-alb-target-group/outputs.tf b/modules/lattice-alb-target-group/outputs.tf
index 816ee05..a4f70f3 100644
--- a/modules/lattice-alb-target-group/outputs.tf
+++ b/modules/lattice-alb-target-group/outputs.tf
@@ -19,7 +19,7 @@ output "vpc" {
}
output "type" {
- description = "The type of target group. Always `IP`."
+ description = "The type of target group. Always `ALB`."
value = aws_vpclattice_target_group.this.type
}
diff --git a/modules/lattice-instance-target-group/README.md b/modules/lattice-instance-target-group/README.md
index eab82d4..5c7f7fa 100644
--- a/modules/lattice-instance-target-group/README.md
+++ b/modules/lattice-instance-target-group/README.md
@@ -63,6 +63,6 @@ This module creates following resources.
| [protocol\_version](#output\_protocol\_version) | The protocol version. |
| [status](#output\_status) | The status of the target group. |
| [targets](#output\_targets) | The list of targets of the target group.
`name` - The name of the target. This value is only used internally within Terraform code.
`instance` - This is the Instance ID for an instance.
`port` - The port on which the target is listening. |
-| [type](#output\_type) | The type of target group. Always `IP`. |
+| [type](#output\_type) | The type of target group. Always `INSTANCE`. |
| [vpc](#output\_vpc) | The ID of the VPC which the target group belongs to. |
diff --git a/modules/lattice-instance-target-group/outputs.tf b/modules/lattice-instance-target-group/outputs.tf
index 97434ed..31d6d3e 100644
--- a/modules/lattice-instance-target-group/outputs.tf
+++ b/modules/lattice-instance-target-group/outputs.tf
@@ -19,7 +19,7 @@ output "vpc" {
}
output "type" {
- description = "The type of target group. Always `IP`."
+ description = "The type of target group. Always `INSTANCE`."
value = aws_vpclattice_target_group.this.type
}
diff --git a/modules/lattice-lambda-target-group/README.md b/modules/lattice-lambda-target-group/README.md
new file mode 100644
index 0000000..5f83684
--- /dev/null
+++ b/modules/lattice-lambda-target-group/README.md
@@ -0,0 +1,58 @@
+# lattice-lambda-target-group
+
+This module creates following resources.
+
+- `aws_vpclattice_target_group`
+- `aws_vpclattice_target_group_attachment` (optional)
+
+
+## Requirements
+
+| Name | Version |
+|------|---------|
+| [terraform](#requirement\_terraform) | >= 1.5 |
+| [aws](#requirement\_aws) | >= 5.12 |
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| [aws](#provider\_aws) | 5.17.0 |
+
+## Modules
+
+| Name | Source | Version |
+|------|--------|---------|
+| [resource\_group](#module\_resource\_group) | tedilabs/misc/aws//modules/resource-group | ~> 0.10.0 |
+
+## Resources
+
+| Name | Type |
+|------|------|
+| [aws_vpclattice_target_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpclattice_target_group) | resource |
+| [aws_vpclattice_target_group_attachment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpclattice_target_group_attachment) | resource |
+
+## Inputs
+
+| Name | Description | Type | Default | Required |
+|------|-------------|------|---------|:--------:|
+| [name](#input\_name) | (Required) The name of the target group. The name must be unique within the account. The valid characters are a-z, 0-9, and hyphens (-). You can't use a hyphen as the first or last character, or immediately after another hyphen. | `string` | n/a | yes |
+| [module\_tags\_enabled](#input\_module\_tags\_enabled) | (Optional) Whether to create AWS Resource Tags for the module informations. | `bool` | `true` | no |
+| [resource\_group\_description](#input\_resource\_group\_description) | (Optional) The description of Resource Group. | `string` | `"Managed by Terraform."` | no |
+| [resource\_group\_enabled](#input\_resource\_group\_enabled) | (Optional) Whether to create Resource Group to find and group AWS resources which are created by this module. | `bool` | `true` | no |
+| [resource\_group\_name](#input\_resource\_group\_name) | (Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with `AWS` or `aws`. | `string` | `""` | no |
+| [tags](#input\_tags) | (Optional) A map of tags to add to all resources. | `map(string)` | `{}` | no |
+| [targets](#input\_targets) | (Optional) A list of targets to add to the target group. Each value of `targets` block as defined below.
(Required) `name` - The name of the target. This value is only used internally within Terraform code.
(Required) `lambda_function` - The Amazon Resource Name (ARN) of the target Lambda function. If your ARN doesn't specify a version or alias, the latest version ($LATEST) is used by default. If the ARN specifies a version or alias, it appears as the last segment of the ARN separated by a colon. |
list(object({| `[]` | no | +| [timeouts](#input\_timeouts) | (Optional) How long to wait for the target group to be created/deleted. |
name = string
lambda_function = string
}))
object({| `{}` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [arn](#output\_arn) | The ARN of the target group. | +| [id](#output\_id) | The ID of the target group. | +| [name](#output\_name) | The name of the target group. | +| [status](#output\_status) | The status of the target group. | +| [targets](#output\_targets) | The list of targets of the target group.
create = optional(string, "5m")
delete = optional(string, "5m")
})