I used a terraform modules to build a re-usable code to provision ec2 instance, vpc, security-groups, load balancer & target group and route53. whlle in main main code I make reference to all the written code and used..
Key things to note
In each module I created main.tf, variable.tf and output.tf files, my main.tf files contain all the code used for provisioning while variable files contain all my variables and output file is used to export some needed resources to refrence in other modules.
Feel free to fork this repo and edit it to your own taste 😋 and use.