This is a template demonstrating a simple CI/CD pipeline using Terraform and GitHub Actions
- Terraform
- GitHub Actions
- AWS
- Docker
- AWS Elastic Container Registry
- Clone the repository and navigate to the working directory
$cd terraform
-
Create an S3 bucket for storing the Terraform state file. Modify the
bucket
name in the remote backend configuration of the terraform block inmain.tf
-
Initialize terraform
$terraform init
- Generate the execution plan
$terraform plan \
-var "public_key=$PUBLIC_KEY" \
-var "private_key=$PRIVATE_KEY" \
-out PLAN
- Perform the execution plan to provision the resources
$terraform apply PLAN
- View the output elastic IP of the deployed EC2 server
$terraform output ec2_server_eip_public
-
To check if the web page is being served correctly by apache as defined in the User Data script, open
<server-ip>:80
in a web browser -
Destroy provisioned resources/Clean-up
$terraform destroy