Project
Terraform Infrastructure
Overview
This is a Terraform rebuild of my 'Serverless Website with CI/CD + IaC on AWS' project. It also uses GitHub Actions for CI/CD. The purpose of this project was for me to gain hands-on experience with Terraform by refactoring my CloudFormation template setup.
1. Architecture
The architecture is deployed using Terraform. It ensures global performance, scalability, and secure delivery: CloudFront accelerates static content, Route 53 provides custom domain management, and DynamoDB + S3 also handle the backend with state locking.
2. High-Level Diagram
This overview shows the core AWS services used, grouped by their role in the solution.
4. Automation Highlights
The project currently uses a single workflow that:
- Prepares state bucket (S3) and database (dynamoDB). These resources are only created if they don't exist.
- Runs terraform commands. This also initialises terraform so that the backend is AWS cloud based and not local. The CloudFront Distribution ID is also captured so an invalidation could be created in the next step.
- Syncs site content. Also creates an invalidation to force refresh site content.
5. Key Learnings / Challenges
- The HCL language used with Terraform.
- The file structure for Terraform.
- Terraform state files and locking.
- CI/CD process for Terraform.
6. Next Steps
- Implementing a visitor counter via API Gateway, Lambda, DynamoDB.
- Adding monitoring and alert tools like CloudWatch and SNS to ensure site is healthy.
7. Links
My Other Projects
CloudFormation, S3, GitHub Actions CI/CD + API Gateway, Lambda, DynamoDB visitor counter + CloudWatch monitoring & SNS alerts.
AWS CDK + CloudFormation + GitHub Actions CI/CD = VPC, EC2, IAM, S3, Centralised CloudWatch + SNS.