Each.value is list of object with 2 elements

resource "aws_security_group_rule" "Synoptek-Edge" {
  //count             = length(var.sg_name)
  security_group_id = "${aws_security_group.names.*.id}"
  for_each = local.foreach
  type = each.value.type
  protocol = each.value.protocol
  from_port = each.value.from
  to_port = each.value.to
  cidr_blocks = [each.value.cidr_blocks]
  description = each.value.description
}

locals {
  foreach = {
    prod = csvdecode(file("${path.module}/csv/Synoptek_Edge.csv"))
  }
}
     Error: Incorrect attribute value type
│ 
│   on security-group.tf line 92, in resource "aws_security_group_rule" "Synoptek-Edge":
│   92:   security_group_id = "${aws_security_group.names.*.id}"
│     ├────────────────
│     │ aws_security_group.names is tuple with 2 elements
│ 
│ Inappropriate value for attribute "security_group_id": string required.
╵
╷
│ Error: Unsupported attribute
│ 
│   on security-group.tf line 94, in resource "aws_security_group_rule" "Synoptek-Edge":
│   94:   type = each.value.type
│     ├────────────────
│     │ each.value is list of object with 2 elements
│ 
│ This value does not have any attributes.
╵
╷
│ Error: Unsupported attribute
│ 
│   on security-group.tf line 95, in resource "aws_security_group_rule" "Synoptek-Edge":
│   95:   protocol = each.value.protocol
│     ├────────────────
│     │ each.value is list of object with 2 elements
│ 
│ This value does not have any attributes.
╵
╷
│ Error: Unsupported attribute
│ 
│   on security-group.tf line 96, in resource "aws_security_group_rule" "Synoptek-Edge":
│   96:   from_port = each.value.from
│     ├────────────────
│     │ each.value is list of object with 2 elements
│ 
│ This value does not have any attributes.
╵
╷
│ Error: Unsupported attribute
│ 
│   on security-group.tf line 97, in resource "aws_security_group_rule" "Synoptek-Edge":
│   97:   to_port = each.value.to
│     ├────────────────
│     │ each.value is list of object with 2 elements
│ 
│ This value does not have any attributes.
╵
╷
│ Error: Unsupported attribute
│ 
│   on security-group.tf line 98, in resource "aws_security_group_rule" "Synoptek-Edge":
│   98:   cidr_blocks = [each.value.cidr_blocks]
│     ├────────────────
│     │ each.value is list of object with 2 elements
│ 
│ This value does not have any attributes.
╵
╷
│ Error: Unsupported attribute
│ 
│   on security-group.tf line 99, in resource "aws_security_group_rule" "Synoptek-Edge":
│   99:   description = each.value.description
│     ├────────────────
│     │ each.value is list of object with 2 elements
│ 
│ This value does not have any attributes.
╵

I’m not quite sure what your question is here, but I wanted to point out that your for_each value is referring to an object with one key (prod). The way you’ve written the resource, it looks like you’re expecting to iterate over the value assigned to prod, in which case perhaps you want to write for_each = local.foreach.prod.

If you can explain what you’re trying to do, and include the format of your CSV file, that might make it easier for someone to help you.