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?