# Error: Failed to connect to the remote host: dial tcp <ip>:22: connect: connection refused

- **ID:** `terraform/provisioner-connection-refused`
- **Domain:** terraform
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

Terraform provisioner cannot establish SSH connection because the remote host is not listening on port 22 or the IP is unreachable.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.4.0 | active | — | — |
| 1.5.0 | active | — | — |
| 1.6.0 | active | — | — |

## Workarounds

1. **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.** (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.
   ```
2. **Check that the instance has booted and SSH service is running. Use cloud-init logs or console output to verify.** (85% success)
   ```
   Check that the instance has booted and SSH service is running. Use cloud-init logs or console output to verify.
   ```

## Dead Ends

- **** — Simply retrying the apply command does not resolve the underlying network issue; the host is still unreachable. (95% fail)
- **** — Adding more timeout in the connection block does not fix the refusal; it only delays the failure. (70% fail)
