hashicorp / terraform-cidr-subnets

A Terraform module for calculating subnet IP address prefixes
Mozilla Public License 2.0
78 stars 41 forks source link

[question] Is there a way I can get a cidr by its name? #1

Closed red8888 closed 3 years ago

red8888 commented 3 years ago

I opened an SO question about this more generically asking about how this sort of thing is possible with terraform: https://stackoverflow.com/questions/64504455/retrieve-a-map-nested-in-a-list-by-searching-for-one-of-its-keys-values

But figured I'd ask in the actual modules page as well.

basically I REALLY want to be able to do something like this with this awesome module: module.subnet_addrs.networks[name = foo]["cidr_block"]

I can get the cidr block by using the index of the list but seeing as how the module lets me name them it would be really awesome and more readable i think to reference them by their name

Is this possible somehow?

red8888 commented 3 years ago

im dumb network_cidr_blocks is exactly for this