Hi@Lakshminarayanan,
You can use command inside your local-exec provisioner. I have attached one example below. You can configure AWS CLI in your local system and use a local-exec provisioner in your terraform code.
resource "aws_instance" "web" {
provisioner "local-exec" {
command = "echo ${aws_instance.web.private_ip} >> private_ips.txt"
}
}
Try to use this approach, it may work.