How to retrieve a specific entry from multiple output?

I have an output defined as follows.

output “subnet_id” {
value = var.deploy_network ? module.vpn[0].private_subnet_id : [ ] #var.subnet_id
}

which returns the following

subnet_id = tolist([
{
“A” = “a”
“B” = “b”
“id” = “100”
“C” = “c”
“D” = “d”
},
])

How can I return just the id?

As seen, there is also a comparison, which requires result as string (I’ve temporarily commented/replaced this).

Update: I changed to the following, which returns id.

value = var.deploy_network ? module.vpn[0].private_subnet_id.*.id[0] : var.subnet_id

Output:

  • subnet_id = “100”