Getting DNS/IP of EC2 instances created through ECS using Terraform

I am struggling in getting the DNS/IP of the EC2 instances (only 1 in my case) created through ECS using Terraform.

Did not find any solution seems like terraform cannot access these ec2 instances.

I am now using userdata to get the DNS name and get it registered to Route53 using awscli commands.