How ping test can do it in terraform with multiple ec2 instance in round robin fashion?

I have more than two ec2-instance in Aws when using terraform apply, I want to do ping test like server 1 to server 2 and server 2 to server 3 … server n to server 1 as a round robin fashion. Anybody know how to achieve this using terraform and get the output result in the output variable.

Hi,
Maybe this blog post will help you

The solution is get data of all provisioned ec2instance public ip in output variable then using remote-exec provisioner to access one host machine then test the remaining host machine using ssh . Note the connection detail must be specified properly and type should be ‘ssh’.

Thanks