I have a group of EC2 instances in a private subnet. These instances don’t have public IP. I need connect to these instances from connection block such next:
connection {
type = “ssh”
host = ???
user = “user”
private_key = “${file(”…/iam/files/id_rsa")}"
}
I created a EC2 Connect Endpoint and I can connect to instances using next command.
aws ec2-instance-connect ssh --instance-id i-xxxyxyxyxyxyy --os-user user
But, it’s possible configure host parameter in Connection Block of Terraform with EC2 Connect Endpoint to connect instantes during “terraform apply”?
If not possible, exist other alternative to perform this?