Unable to create EC2 instance using terraform

Unable to create EC2 instance. I have created subnet manually for default VPC and tried but still same error. KIndly help on it

creating EC2 Instance: operation error EC2: RunInstances, https response error StatusCode: 400, RequestID: 1f5f1d46-95ed-4d19-a931-c11744566ebb, api error MissingInput: No subnets found for the default VPC ‘vpc-0dfa29ece1e845ecb’. Please specify a subnet.

│ with aws_instance.ec2_instance,
│ on main.tf line 26, in resource “aws_instance” “ec2_instance”:
│ 26: resource “aws_instance” “ec2_instance” {

Hi @nithyaks

It primarily appears that there’s some issue while declaring the subnet resource in the TF code.

It would help if you could share the Terraform code for the above.

Regards.