terraform
network_error
ai_generated
true
Error: Failed to connect to the remote host: dial tcp <ip>:22: connect: connection refused
ID: terraform/provisioner-connection-refused
90%Fix Rate
88%Confidence
1Evidence
2023-06-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.4.0 | active | — | — | — |
| 1.5.0 | active | — | — | — |
| 1.6.0 | active | — | — | — |
Root Cause
Terraform provisioner cannot establish SSH connection because the remote host is not listening on port 22 or the IP is unreachable.
generic中文
Terraform provisioner 无法建立 SSH 连接,因为远程主机未在端口 22 上监听或 IP 不可达。
Official Documentation
https://developer.hashicorp.com/terraform/language/resources/provisioners/connectionWorkarounds
-
90% success Verify that the security group allows inbound traffic on port 22 and that the instance has a public IP. Use 'ssh -vvv user@ip' to test connectivity.
Verify that the security group allows inbound traffic on port 22 and that the instance has a public IP. Use 'ssh -vvv user@ip' to test connectivity.
-
85% success Check that the instance has booted and SSH service is running. Use cloud-init logs or console output to verify.
Check that the instance has booted and SSH service is running. Use cloud-init logs or console output to verify.
中文步骤
验证安全组允许端口 22 的入站流量,并且实例具有公共 IP。使用 'ssh -vvv user@ip' 测试连接。
检查实例是否已启动并且 SSH 服务正在运行。使用 cloud-init 日志或控制台输出进行验证。
Dead Ends
Common approaches that don't work:
-
95% fail
Simply retrying the apply command does not resolve the underlying network issue; the host is still unreachable.
-
70% fail
Adding more timeout in the connection block does not fix the refusal; it only delays the failure.