Segregation of output in terraform

Hi All, We are creating aws route53 resolver rule. For this we have already created rotue 53 inbound and outbound endpoint but to create the rule i need the IP address created as part of inbound endpoint

image

Now I need to get those 2 IPS and put like below in another resource. Please help on how can i get those 2 values into this resource.

image

Terraform gives us a handful of ways to declare resources. The most readable way is to directly assign values. Values are great! Values are readable, universally compatible, and invariant.

resource "aws_route53_resolver_rule" "fwd" {
  domain_name          = "example.com"
  name                 = "example"
  rule_type            = "FORWARD"
  resolver_endpoint_id = "rni-1068c67cb2db4e0e8"

  target_ip {
    ip = "10.82.18.183"
  }
}

resource "aws_route53_resolver_rule" "fwd" {
  domain_name          = "example.com"
  name                 = "example"
  rule_type            = "FORWARD"
  resolver_endpoint_id = "rni-328005a4648a42838"

  target_ip {
    ip = "10.82.20.181"
  }
}