Issue while making use of output values as MAP

Hello friends, I’m using a module(ocp-az12) which creates 2 openshift projects and outputs AZ names(AZ1 and AZ2) and project IDs:->

output “ocp_project_id_map” {
value = zipmap(
values(ocp_project.this)..affinity, ==> This gives AZ
values(ocp_project.this).
.id ==> This gives project ID
)
description = “Name and Id of the created OpenShift project”
}

Now I want to create 2 load balancer(1st for AZ1 and 2nd for AZ2) each of which requires openshift project ID:

resource “ocp_route_lb” “az1” {
name = var.name
project_id = module.ocp-az12.ocp_project_id_map[“AZ1”]

resource “ocp_route_lb” “az2” {
name = var.name
project_id = module.ocp-az12.ocp_project_id_map[“AZ2”]

If I use hardcoded value “AZ1” & “AZ2” while refering the module as above, it is fetching the project_id perfectly.

However, I want to fetch the AZ name from the module’s output MAP and not hardcode it. How can I achieve this?

You’d need to use for_each with the output of the module but would then face the same issue reported here

Hi… I’m not suppose to modify the existing module.

Your stated requirements, require you to modify the existing module - or at least, they do, given the limited detail you have shared about it so far.

Please can you post all the code of this module?

To do what you want, it’s necessary that there be a way for Terraform to discover the AZ names at plan-time, before any apply has executed. That doesn’t seem to be possible given the one module output you’ve shared with us.