Nested for_each & for loops from multiple resource outputs

Hi

I’m using the genesysCloud provider for my project. The end goal is to provide values for 2 resources from 2 csv files, but baby steps at first.

Resource 1 creates genesysCloud schedules for me and returns the resource id that I will need in resource 2 which creates schedule-groups.
Resource 1 is working as expected.

Output from resource 1

output from resource 1 using statement
for k, v in genesyscloud_architect_schedules.all_schedule : k => v.id

all_schedule-ids = {
“Australia_Day” = “49fa57ec-283d-4499-aa59-1a3c67303828”
“Boxing_Day” = “d36ccc3a-bd8c-425b-87d1-3f40606424da”
“Christmas_Day” = “cf983444-283c-4c1e-8513-1ecd40f1b86f”
“Christmas_Eve” = “2489b061-4b6a-40d5-bd8d-aeca1da172c5”
}


Resource 2:

I’ve created:

locals {

schedule-open = ["Australia_Day ", “Boxing_Day”]
schedule-closed = ["Christmas_Day ",“Christmas_Eve”]

schedule-open-ids = {
for k, v in genesyscloud_architect_schedules.all_schedule : k => v.id if k == “Australia_Day”
}
}

The output from locals is :

schedule-open-ids = {
“Australia_Day” = “49fa57ec-283d-4499-aa59-1a3c67303828”
}

How do I update the “schedule-open-ids” to loop through “local.schedule-open” and return a list of ids from resource 1 ids that matches the list of schedule-open?

My expected output needs to be a list like:

schedule-open-ids = [“49fa57ec-283d-4499-aa59-1a3c67303828”,“d36ccc3a-bd8c-425b-87d1-3f40606424da”]

Or is there a better way of doing this?
TIA