Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ permissions:
id-token: write
contents: read

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

concurrency:
group: development-deployment
cancel-in-progress: true
Expand All @@ -24,9 +27,11 @@ jobs:
working-directory: .

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v5

- uses: actions/setup-node@v4
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22
cache: npm
Expand All @@ -45,7 +50,7 @@ jobs:
echo "Environment: dev"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data
*.tfvars
*.tfvars.json
.tfvars*
.tfvars

# Ignore override files
override.tf
Expand Down
45 changes: 33 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This system provisions and connects:

---

## 📁 Project Structure (Typical)
## 📁 Project Structure

```
.
Expand All @@ -50,9 +50,9 @@ This system provisions and connects:
├── index.html # Vite entry HTML file
├── package.json + other configs # Project dependencies and scripts
├── terraform/ # Infrastructure as Code (Terraform)
├── terraform/ # Infrastructure as Code (Terraform) directory
│ │
│ ├── bootstrap/ # One-time setup (state backend, foundational resources)
│ ├── bootstrap/ # One-time setup (state backend, foundational resource)
│ │
│ ├── modules/ # Reusable Terraform modules
│ │ │
Expand Down Expand Up @@ -88,7 +88,6 @@ This project was built with:
- Reusable Terraform modules for multi-project usage
- Production-ready S3 security configuration
- Clean separation of infrastructure and frontend build
- Remote state backend with state locking

---

Expand Down Expand Up @@ -265,16 +264,32 @@ Just change:
- S3 bucket is private by default
- CloudFront serves as the only public entry point
- IAM follows least privilege principle
- GitHub Actions uses short-lived credentials (OIDC)
- No hardcoded secrets in repo

---

## 📈 Lessons Learned
## 🧱 Infrastructure Teardown

- Add custom domain + Route53 automation
- ACM SSL certificate provisioning
- Automated performance testing in CI
1. From each environment directory (dev, staging and prod), run the command:

```
terraform destroy -auto-approve
```

Do this for all environments.

2. From the terraform **_bootstrap_** directory, run the command:

```
terraform destroy -auto-approve

```

3. Optional, but can do: List all AWS buckets in your account and confirmbuckets are not listed. Run the command:

```
aws s3 ls

```

---

Expand Down Expand Up @@ -387,6 +402,12 @@ Writing reusable setup instructions and architecture explanations can improve:

---

## 👨‍💻 Author
## 📈 Future Improvements

- Add custom domain + Route53 automation
- ACM SSL certificate provisioning
- Automated performance testing in CI

Built and Maintained by [ecoderP](https://github.com/ecoderP)
---

## 👨‍💻 Author
4 changes: 4 additions & 0 deletions terraform/bootstrap/terraform.tfvarsexample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
aws_region = "Your AWS region"
project_name = "Your project name"
backend_bucket_name = "Your unique bucket name"
s3_encryption_algorithm = "AES256" # Default to SSE-S3
5 changes: 5 additions & 0 deletions terraform/environments/dev/dev.tfbackendexample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bucket = "Your bootstrap backend state bucket name"
region = "Your AWS region"
key = "dev/terraform.tfstate"
encrypt = true
use_lockfile = true # important for S3 backend state lock
6 changes: 6 additions & 0 deletions terraform/environments/dev/terraform.tfvarsexample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
aws_region = "Your AWS region"
project_name = "Project name"
website_bucket_name = "Your unique bucket name" # unique for each environment
github_repo = "Your-github-username/repo-name" # Not web link
github_branch = "dev"
environment = "dev"
5 changes: 5 additions & 0 deletions terraform/environments/prod/prod.tfbackendexample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bucket = "Your bootstrap backend state bucket name"
region = "Your AWS region"
key = "prod/terraform.tfstate"
encrypt = true
use_lockfile = true # important for S3 backend state lock
6 changes: 6 additions & 0 deletions terraform/environments/prod/terraform.tfvarsexample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
aws_region = "Your AWS region"
project_name = "Project name"
website_bucket_name = "Your unique bucket name"
github_repo = "Your github username/repo name" # Not web link
github_branch = "prod"
environment = "prod"
5 changes: 5 additions & 0 deletions terraform/environments/staging/staging.tfbackendexample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bucket = "Your bootstrap backend state bucket name"
region = "Your AWS region"
key = "staging/terraform.tfstate"
encrypt = true
use_lockfile = true # important for S3 backend state lock
6 changes: 6 additions & 0 deletions terraform/environments/staging/terraform.tfvarsexample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
aws_region = "Your AWS region"
project_name = "Project name"
website_bucket_name = "Your unique bucket name" # unique for each environment
github_repo = "Your github username/repo name" # Not web link
github_branch = "staging"
environment = "staging"
Loading