Dynamic List from data to resource dynamic list

Hi team, i am not sure HOW to tacle this. I have the concept in mind but not sure how to execute

So i have a GKE cluster that has 6 nodes, each node has an external IP that i have to grab and add those IP with a specific list format to a resource. (Currently doing this manually and it sucks)

a co-worker pointed me to this https://www.hashicorp.com/blog/hashicorp-terraform-0-12-preview-for-and-for-each/#dynamic-nested-blocks but he is swamped and i cant seem to figure out how to grab all 6 node ips (each node is randomnly named) -> resource that requires the below structure and dynaically add the ip’s

thanks in advance!
using TF 12

get ips from gke

data "google_compute_instance" "appserver" {
  name = "primary-application-server"
  zone = "us-central1-a"
}
resource "mongodbatlas_project_ip_whitelist" "test" {
    project_id = <PROJECT-ID>

    whitelist {
      cidr_block = "1.2.3.4/32"
}

Now that 0.12 is out of preview, I recommend to read this instead of the preview blog post