# Lookup over map object

**URL:** <https://discuss.hashicorp.com/t/lookup-over-map-object/28948>\
**Category:** Terraform\
**Created:** [August 31, 2021, 3:14pm UTC](https://discuss.hashicorp.com/t/lookup-over-map-object/28948 "2021-08-31T15:14:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmancebo](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mmancebo/32/14185_2.png) [@mmancebo](https://discuss.hashicorp.com/u/mmancebo)\
**Post date:** [August 31, 2021, 3:14pm UTC](https://discuss.hashicorp.com/t/lookup-over-map-object/28948/1 "2021-08-31T15:14:14Z")

</div>

I have the following variable

variable “something\_info” {  
description = “Host info”  
type = map(object({  
server\_name = string  
instance\_type = string  
assoc\_public\_ipaddr = bool  
ami\_owners = list(string)  
ami\_name = list(string)  
volume\_size = number  
ingress\_list = list(object({  
from\_port = number  
to\_port = number  
protocol = string  
cidr\_blocks = list(string)  
}))  
egress\_list = list(object({  
from\_port = number  
to\_port = number  
protocol = string  
cidr\_blocks = list(string)  
}))  
}))  
default = {  
host1 = {  
server\_name = “my\_host”  
instance\_type = “t2.small”  
assoc\_public\_ipaddr = true  
ami\_owners = [“amazon”]  
ami\_name = [“amzn2-ami-hvm- _-x86\_64-gp2”]  
volume\_size = 20  
ingress\_list = [{  
from\_port = -1  
to\_port = -1  
protocol = “icmp”  
cidr\_blocks = [“0.0.0.0/0”]  
},  
{  
from\_port = 22  
to\_port = 22  
protocol = “tcp”  
cidr\_blocks = [“0.0.0.0/32”]  
}],  
egress\_list = [{  
from\_port = 0  
to\_port = 0  
protocol = “-1”  
cidr\_blocks = [“0.0.0.0/0”]  
}]  
}  
host2 = {  
server\_name = “my\_host2”  
instance\_type = “t3.xlarge”  
assoc\_public\_ipaddr = true  
ami\_owners = [“amazon”]  
ami\_name = [“amzn2-ami-hvm-_ -x86\_64-gp2”]  
volume\_size = 100  
ingress\_list = [{  
from\_port = -1  
to\_port = -1  
protocol = “icmp”  
cidr\_blocks = [“0.0.0.0/0”]  
},  
{  
from\_port = 22  
to\_port = 22  
protocol = “tcp”  
cidr\_blocks = [“0.0.0.0/32”]  
}],  
egress\_list = [{  
from\_port = 0  
to\_port = 0  
protocol = “-1”  
cidr\_blocks = [“0.0.0.0/0”]  
}]  
}  
}  
}

my module is basically like this.

for\_each = var.something\_info  
ami\_name = each.value[“ami\_name”]  
ami\_owners = each.value[“ami\_owners”]  
ec2\_tags = merge(var.tags, { Name = each.value.server\_name })  
instance\_type = each.value[“instance\_type”]  
assoc\_public\_ipaddr = each.value[“assoc\_public\_ipaddr”]  
volume\_size = each.value[“volume\_size”]

the thing is, I need to do a lookup to search a specific variable (ingress\_list for example) , but I can’t find a way to do it, as my lookup says that the variable doesn’t exist, is there any other way?

Thanks in advance
