Skip to content

Commit

Permalink
Adding second subnet for ALB setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Elhaiek committed Apr 8, 2024
1 parent d051695 commit 6657c54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
run: terraform init
working-directory: terraform

- name: Terraform Refresh
run: terraform refresh
working-directory: terraform
# - name: Terraform Refresh
# run: terraform refresh
# working-directory: terraform

- name: Terraform Plan
run: terraform plan -out=tfplan
Expand Down
13 changes: 12 additions & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ resource "aws_subnet" "vectorstore_subnet" {
}
}

# Second subnet in a different Availability Zone (For ALB to work)
resource "aws_subnet" "vectorstore_subnet_2" {
vpc_id = aws_vpc.vectorstore_vpc.id
cidr_block = "10.0.2.0/24"
availability_zone = "us-east-1b" # Change this to a different zone from the first subnet
tags = {
Name = "vectorstore_subnet_2"
}
}


resource "aws_internet_gateway" "vectorstore_igw" {
vpc_id = aws_vpc.vectorstore_vpc.id
tags = {
Expand Down Expand Up @@ -75,7 +86,7 @@ resource "aws_lb" "vectorstore_nlb" {
name = "vectorstore-nlb"
internal = true #INTERNAL NLB, ONLY ACCESSIBLE VIA VPC LINK
load_balancer_type = "application"
subnets = [aws_subnet.vectorstore_subnet.id]
subnets = [aws_subnet.vectorstore_subnet.id, aws_subnet.vectorstore_subnet_2.id]
enable_deletion_protection = false

tags = {
Expand Down

0 comments on commit 6657c54

Please sign in to comment.