How to get Pod IP for use in config of another pod on k8s?

I need to grab the assigned IP address of a created Pod or Deployment for use in the Config part of another Pod/Deployment. How do you do this with Terraform? The command to get a Pod’s IP is pretty simple ($ kubectl get pod mypod-6bbf4f8985-ntd86 -o=json | jq .status.podIP) …is there a way to run this on the remote k8s cluster and stuff the answer into an env var or Terraform output??