Identify uniquely a target group using ip network socket equation (cidrhost function enhancement ?)

Hello guys,

I was thinking of this while trying to edit alb listeners target groups and I didn’t find a way to realize this easily.

I wanted to add some intellect to my code by identifying each of my target group uniquely with a simple equation inspired from network socket.

IP address + port = target_group_id

I think that my equation is correct and has no error in it except if we consider port 0 which should not be existing in this case.

But unfortunately, the terraform function cidrhost() does not provide a way to print a decimal value of the resulting host. It would be great to define unique index that could identify a target group for example.

Any feedback on this ? It does not sounds too hard to implement in terraform but my usecase sounds like too specific also ^^