This is the code used in the free course on Udemy for "Hands-on Terraform Foundation" on AWS EC2.
Please find the code attached and add appropriate changed to your security group to allow your IP address to access your VPC and create your own ssh key.