resource "aws_network_acl" "nacl_public" {
  vpc_id = aws_vpc.vpc.id

  egress {
    protocol   = "-1"
    rule_no    = 100
    action     = "allow"
    cidr_block = "0.0.0.0/0"
    from_port  = 0
    to_port    = 0
  }

  ingress {
    protocol   = "-1"
    rule_no    = 100
    action     = "allow"
    cidr_block = "0.0.0.0/0"
    from_port  = 0
    to_port    = 0
  }

  subnet_ids = [
    aws_subnet.public_a.id,
    aws_subnet.public_b.id
  ]

  tags = {
    Name = "${var.client_name}_public_nacl"
  }
}

# resource "aws_network_acl" "elb_web_private_nacl" {
#   vpc_id = aws_vpc.vpc.id

#   egress {
#     protocol   = "-1"
#     rule_no    = 100
#     action     = "allow"
#     cidr_block = "0.0.0.0/0"
#     from_port  = 0
#     to_port    = 0
#   }

#   ingress {
#     protocol   = "-1"
#     rule_no    = 100
#     action     = "allow"
#     cidr_block = "0.0.0.0/0"
#     from_port  = 0
#     to_port    = 0
#   }

#   subnet_ids = [
#     aws_subnet.elb_web_public_a.id,
#     aws_subnet.elb_web_public_b.id
#   ]

#   tags = {
#     Name = "${var.client_name}_elb_web_public_nacl"
#   }
# }

# resource "aws_network_acl" "web_private_nacl" {
#   vpc_id = aws_vpc.vpc.id

#   egress {
#     protocol   = "-1"
#     rule_no    = 100
#     action     = "allow"
#     cidr_block = "0.0.0.0/0"
#     from_port  = 0
#     to_port    = 0
#   }

#   ingress {
#     protocol   = "-1"
#     rule_no    = 100
#     action     = "allow"
#     cidr_block = "0.0.0.0/0"
#     from_port  = 0
#     to_port    = 0
#   }

#   subnet_ids = [
#     aws_subnet.web_private_a.id,
#     aws_subnet.web_private_b.id
#   ]

#   tags = {
#     Name = "${var.client_name}_web_private_nacl"
#   }
# }

resource "aws_network_acl" "db_private_nacl" {
  vpc_id = aws_vpc.vpc.id

  egress {
    protocol   = "-1"
    rule_no    = 100
    action     = "allow"
    cidr_block = "0.0.0.0/0"
    from_port  = 0
    to_port    = 0
  }

  ingress {
    protocol   = "-1"
    rule_no    = 100
    action     = "allow"
    cidr_block = "0.0.0.0/0"
    from_port  = 0
    to_port    = 0
  }

  subnet_ids = [
    aws_subnet.mysql_db_a.id,
    aws_subnet.mysql_db_b.id
  ]

  tags = {
    Name = "${var.client_name}_db_private_nacl"
  }
}
