1
Understand Terraform basics
hard
Refer to the exhibit. A user applies this configuration. They then run 'terraform destroy' but the destroy fails with an error: 'Error deleting load balancer: DependencyViolation: The load balancer 'arn:aws:elasticloadbalancing:...' cannot be deleted because it is currently associated with another resource.' The user has not made any changes to the resources. What is the most likely cause?
Exhibit
resource "aws_lb" "frontend" {
name = "frontend-alb"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.alb.id]
subnets = ["subnet-12345678", "subnet-87654321"]
}
resource "aws_lb_listener" "frontend_http" {
load_balancer_arn = aws_lb.frontend.arn
port = 80
protocol = "HTTP"
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.frontend.arn
}
}
resource "aws_lb_target_group" "frontend" {
name = "frontend-tg"
port = 80
protocol = "HTTP"
vpc_id = "vpc-12345678"
}