This repository contains the Terraform configuration for setting up infrastructure components including EC2 instances, Parameter Store, and AWS CodePipeline. Below is an overview of each module and the steps to deploy using Terraform.
In this module, an EC2 instance is created and configured with the necessary packages using user data. Additionally, a security group is attached to the instance, allowing open access to ports 80 and 443 while restricting port 22 to specific IP addresses for private access.
The Parameter Store module serves as a simple solution for storing application environment variables (.env file). These secrets can be included during the build pipeline creation process.
This module encompasses the creation of a pipeline to deploy changes to the server upon pushing changes to the master branch of the repository. The pipeline includes application and deployment group creation, with the existing EC2 instance added to the deployment group. While auto-scaling groups can be added for scalability, this setup focuses on simplicity by including only one instance in the group.
- Run
terraform init
to download and install modules, and initialize the backend. - Use
terraform validate
to check the syntax and configuration of the .tf files. - Generate an execution plan using
terraform plan
. - Deploy changes to the cloud with
terraform apply
. To destroy all managed resources, runterraform destroy
.
For detailed instructions and best practices, please refer to the respective module directories.