Iterating Dynamic Nested Blocks Query

Hi I am trying to work out the best technique for this approach.

It is probably discussed somewhere in here , I am parsing a list of values
to iterate a dynamic list, but when I remove an entry in the list it reindexes the latter entries.

ingress_ports_access_public = [22, 80, 443]

/* resource “aws_security_group” “test_sg” {
description = “Access Group”
vpc_id = aws_vpc.main.id
dynamic “ingress” {
iterator = port
for_each = toset(var.ingress_ports_access_public)
content {
from_port = port.value
to_port = port.value
protocol = “tcp”
cidr_blocks = [“10.0.0.0/8”]
}
}