When you launch a server instance with Terraform, sometimes the error message does not contain the underlying cause. When the cloud provider cannot complete the request, many times Terraform displays a generic error message:
Error waiting for instance (i-...) to become ready: unexpected state 'terminated', wanted target 'running'
To find the root cause of the error in AWS
- Log into the AWS console and navigate to the EC2 section,
- Search for the instance by the instance Id,
- You can find the error message at the bottom of the Description tab
In our specific case, it was Client.VolumeLimitExceeded: Volume limit exceeded
We had to increase the volume limit to be able to launch more large EC2 instances.