To ssh in your EC2 instance, you have to provide user and private key. In Terraform you can use connection keyword to ssh in EC2 instance. I have attached one example for your reference.
type = "ssh"
user = "ec2-user"
private_key = file("C:/Users/Nadeem Akhtar/Downloads/mysecure.pem")
host = aws_instance.web.public_ip