Terraform ECS with ec2 launch type

how to define ec2 instance along with AMI image id , instance type , keypair , vpc security group for ECS in terraform

should i use ec2 autoscaling along with launch template . and how to be identified in ECS cluster
and does the container need seperate subnet than subnet of ec2 intstances
for ec2 instance subnet 96.120.10.0/24
for container subnets 96.120.20.0/24