This repository contains the necessary instructions and Terraform code to deploy an infrastructure stack on a cloud provider using Terraform. The following steps will guide you through the process of creating a VPC, internet gateway, custom route table, subnet, security group, network interface, elastic IP, and an Ubuntu server with Apache2 installed and enabled.
Before starting the deployment process, make sure you have the following prerequisites:
- Terraform installed on your local machine. You can download it from the official Terraform website.
- An account with the chosen cloud provider.
- Appropriate access and permissions to create the required resources.
- Basic knowledge of Terraform and the cloud provider's infrastructure and networking concepts.
Follow the steps below to deploy the infrastructure stack using Terraform:
- Clone or download this repository to your local machine.
- Install the necessary Terraform providers by running
terraform init
within the repository's directory. - Add your AWS access key , secret key and also the region.
- Open the
main.tf
file. - Configure the desired VPC settings, such as CIDR block, name, and other parameters.
- Within the same
main.tf
file, configure the internet gateway settings. - Associate the internet gateway with the previously created VPC.
- In the
main.tf
file, configure the custom route table settings. - Associate the route table with the VPC.
- Configure the subnet settings in the
main.tf
file. - Associate the subnet with the VPC.
- Configure the security group settings in the
main.tf
file. - Allow inbound traffic on ports 22(SSH), 80(HTTP), and 443(HTTPS).
- Configure the network interface settings in the
main.tf
file. - Associate the network interface with the previously created subnet.
- Configure the elastic IP settings in the
main.tf
file. - Associate the elastic IP with the network interface.
- Configure the Ubuntu server settings in the
main.tf
file. - Run
terraform apply
to create the Ubuntu server and install Apache2.
Congratulations! You have successfully deployed an infrastructure stack on AWS using Terraform. The stack includes a VPC, internet gateway, custom route table, subnet, security group, network interface, elastic IP, and an Ubuntu server with Apache2 installed and enabled. You can now access the Ubuntu server over the internet using the elastic IP and start hosting your websites or applications.
Please refer to the Terraform documentation and guides provided by your cloud provider for more detailed information on each step and additional customization options.