resource "aws_lb" "redirect-lb" {
name = var.alb_components["redirect_lb"].name
internal = false
load_balancer_type = var.alb_components["redirect_lb"].load_balancer_type
security_groups = [data.aws_security_group.redirect_lb.id]
subnets = data.aws_subnets.selected.ids
enable_deletion_protection = false
access_logs {
bucket = aws_s3_bucket.redirect-s3.id
enabled = true
}
tags = merge(
var.all_static_tags,
local.all_dyn_tags,
{
"Name" = var.alb_components["redirect_lb"].name
"Public" = "false",
"Component" = "lb"
}
)
}
VPC Module
data "aws_vpc" "selected" {
provider = aws.a112-r5
filter {
name = "tag:Name"
values = ["ASG-vpc"]
}
}
Subnets Module
data "aws_subnets" "selected" {
provider = aws.a112-r5
filter {
name = "vpc-id"
values = [data.aws_vpc.selected.id]
}
filter {
name = "tag:Name"
values = ["ASG-subnet-public1-us-west-2a", "ASG-subnet-public2-us-west-2b"]
}
}
im getting an error
: creating ELBv2 application Load Balancer (redirect): SubnetNotFound: InvalidSubnetID.NotFound
│ status code: 400, request id: bb629a99-5d69-4029-8bbb-d8a3925a56f3
│
│ with aws_lb.redirect-lb,
│ on alb.tf line 30, in resource "aws_lb" "redirect-lb":
│ 30: resource "aws_lb" "redirect-lb" {
│
my output
subnets = [
+ "subnet-0006d63aa0d1dxxxx",
+ "subnet-0b65cb4491415xxxx",
i’ve tried to troubleshoot but i cant seem to find a solution. please i need help. trying to deploy my alb public facing alb in a public subnet but the error is confusing because its corresponds to the same subnet id in the console
New contributor
user24653763 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.