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.

High-Level Diagram of solution, grouping AWS services together by their function.

3. Detailed Flow

Covers CI/CD pipeline, Terraform IaC deployed services, and end user path.

Detailed Flow diagram of solution, showing user and development paths.

4. Automation Highlights

The project currently uses a single workflow that:

  1. Prepares state bucket (S3) and database (dynamoDB). These resources are only created if they don't exist.
  2. 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.
  3. 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.

My Other Projects

Cloud Icon

Serverless Portfolio

CloudFormation, S3, GitHub Actions CI/CD + API Gateway, Lambda, DynamoDB visitor counter + CloudWatch monitoring & SNS alerts.

AWS CDK Logo

CDK Landing Zone

AWS CDK + CloudFormation + GitHub Actions CI/CD = VPC, EC2, IAM, S3, Centralised CloudWatch + SNS.