Deploying with Terraform
The workflow design In my previous posts, I focused on understanding Infrastructure as Code and setting up my environment. Now it is time to actually build something. In today's challenge, we are t...

Source: DEV Community
The workflow design In my previous posts, I focused on understanding Infrastructure as Code and setting up my environment. Now it is time to actually build something. In today's challenge, we are to build our website using Terraform. What I Built I used Terraform to create a simple EC2 instance on AWS and made it accessible from the browser. The setup included: A provider block to connect to AWS A resource block to create the EC2 instance A security group to allow HTTP traffic on port 80 A user data script to serve a simple HTML page. To deploy the server, I ran: terraform init terraform plan terraform apply -auto-approve Confirming the Server After running terraform apply, Terraform returned a public IP in the AWS Console. I copied the public IP generated and pasted it into the browser: That confirmed that the server was running and accessible. The challenges I faced One issue I encountered was using an invalid AMI. At first, my instance failed to launch because the AMI was not valid