Skip to content

Commit 7d41528

Browse files
MukeshMukesh
authored andcommitted
update
1 parent 96060b2 commit 7d41528

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

modules/api-gateways/main.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ resource "aws_apigatewayv2_route" "root_route" {
3131
}
3232

3333
# Create a VPC Link
34-
resource "aws_apigatewayv2_vpc_link" "example" {
34+
resource "aws_apigatewayv2_vpc_link" "vpc_link" {
3535
name = "${var.customer}-vpc-link"
3636
security_group_ids = [var.vpc_link_security_group_id]
37-
subnet_ids = []
37+
subnet_ids = var.subnet_ids
3838
}
3939

4040
# Integration for the "/" route
@@ -44,6 +44,8 @@ resource "aws_apigatewayv2_integration" "root_integration" {
4444
integration_uri = var.alb_dns
4545
integration_method = "GET"
4646
payload_format_version = "1.0"
47+
connection_type = "VPC_LINK"
48+
connection_id = aws_apigatewayv2_vpc_link.vpc_link.id
4749
}
4850

4951
# Integration for the "/api/v1/hi" route
@@ -53,6 +55,8 @@ resource "aws_apigatewayv2_integration" "api_v1_hi_integration" {
5355
integration_uri = "${var.alb_dns}/api/v1/hi"
5456
integration_method = "GET"
5557
payload_format_version = "1.0"
58+
connection_type = "VPC_LINK"
59+
connection_id = aws_apigatewayv2_vpc_link.vpc_link.id
5660
}
5761

5862
# "dev" stage for the HTTP API

modules/api-gateways/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ variable "region" {
99
variable "customer" {
1010
type = string
1111
}
12+
13+
variable "vpc_link_security_group_id" {
14+
type = string
15+
}
16+
17+
variable "subnet_ids" {
18+
type = string
19+
}

0 commit comments

Comments
 (0)