Skip to content

Commit 0834729

Browse files
authored
Merge pull request #44 from amazeeio/dev
Maintenance tasks and terraform updates
2 parents a5e468e + 9d2b284 commit 0834729

File tree

9 files changed

+107
-26
lines changed

9 files changed

+107
-26
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,11 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, dev ]
66
pull_request:
77
branches: [ main, dev ]
88

99
jobs:
10-
frontend-tests:
11-
runs-on: ubuntu-latest
12-
defaults:
13-
run:
14-
working-directory: .
15-
16-
steps:
17-
- uses: actions/checkout@v4
18-
19-
- name: Set up Docker
20-
uses: docker/setup-buildx-action@v3
21-
22-
- name: Run frontend tests
23-
run: make frontend-test
24-
2510
backend-tests:
2611
runs-on: ubuntu-latest
2712
defaults:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ Access the services at:
157157
### Frontend
158158
- `NEXT_PUBLIC_API_URL`: Backend API URL
159159

160+
## 🌍 Terraform
161+
162+
This project includes the default terraform details needed to set up remote AWS resources (IAM roles and users, DDB tables, etc).
163+
160164
## 👥 Contributing
161165

162166
1. Create a new branch for your feature

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@types/react-dom": "^18",
5151
"eslint": "^9",
5252
"eslint-config-next": "15.1.7",
53-
"postcss": "^8",
53+
"postcss": "^8.5.3",
5454
"tailwindcss": "^3.4.1",
5555
"typescript": "^5"
5656
}

requirements-test.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
pytest==8.0.0
1+
pytest==8.3.3
22
pytest-asyncio==0.23.5
33
pytest-cov==4.1.0
4-
httpx==0.26.0
4+
httpx==0.28.1
55
requests-mock==1.11.0
6-
faker==22.6.0
7-
pytest-env==1.1.3
6+
faker==22.7.0
7+
pytest-env==1.1.5

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
fastapi==0.109.2
1+
fastapi==0.115.12
22
uvicorn==0.27.1
3-
sqlalchemy==2.0.27
3+
sqlalchemy==2.0.40
44
pydantic==2.6.1
55
pydantic-settings==2.1.0
66
python-jose[cryptography]==3.4.0
@@ -10,7 +10,7 @@ asyncpg==0.29.0
1010
psycopg2-binary==2.9.9
1111
requests==2.32.2
1212
python-dotenv==1.0.1
13-
alembic==1.13.1
13+
alembic==1.15.2
1414
boto3==1.35.1
1515
markdown==3.5.2
16-
email-validator==2.1.2
16+
email-validator==2.1.2

terraform/backend.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
terraform {
2+
backend "s3" {
3+
bucket = "amazeeai-terraform-state-dev"
4+
key = "terraform.tfstate"
5+
region = "eu-central-2"
6+
use_lockfile = true
7+
encrypt = true
8+
}
9+
}

terraform/main.tf

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,75 @@ resource "aws_dynamodb_table" "verification_codes" {
157157

158158
tags = var.tags
159159
}
160+
161+
resource "aws_dynamodb_table" "lite_llm_usage" {
162+
name = "amazeeai-litellm-usage-${var.environment_suffix}"
163+
billing_mode = "PAY_PER_REQUEST"
164+
deletion_protection_enabled = local.is_production_environment
165+
166+
hash_key = "id"
167+
range_key = "startTime"
168+
169+
attribute {
170+
name = "id"
171+
type = "S"
172+
}
173+
174+
attribute {
175+
name = "startTime"
176+
type = "S"
177+
}
178+
179+
attribute {
180+
name = "model"
181+
type = "S"
182+
}
183+
184+
global_secondary_index {
185+
name = "ModelIndex"
186+
hash_key = "model"
187+
range_key = "startTime"
188+
projection_type = "ALL"
189+
}
190+
191+
tags = var.tags
192+
}
193+
194+
resource "aws_iam_user" "litellm" {
195+
name = "amazeeai-litellm-${var.environment_suffix}"
196+
tags = var.tags
197+
198+
lifecycle {
199+
prevent_destroy = true
200+
}
201+
}
202+
203+
resource "aws_iam_access_key" "litellm" {
204+
user = aws_iam_user.litellm.name
205+
}
206+
207+
resource "aws_iam_user_policy" "litellm" {
208+
name = "amazeeai-litellm-ddb-${var.environment_suffix}"
209+
user = aws_iam_user.litellm.name
210+
211+
policy = jsonencode({
212+
Version = "2012-10-17"
213+
Statement = [
214+
{
215+
Sid = "DynamoDBPutItemOnly"
216+
Effect = "Allow"
217+
Action = [
218+
"dynamodb:PutItem"
219+
]
220+
Resource = [
221+
aws_dynamodb_table.lite_llm_usage.arn
222+
]
223+
}
224+
]
225+
})
226+
}
227+
228+
resource "aws_iam_user_policy_attachment" "litellm_bedrock" {
229+
user = aws_iam_user.litellm.name
230+
policy_arn = "arn:aws:iam::aws:policy/AmazonBedrockFullAccess"
231+
}

terraform/outputs.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,16 @@ output "role_assumer_secret_key" {
2727
description = "Secret access key for the role assumer user"
2828
value = aws_iam_access_key.role_assumer.secret
2929
sensitive = true
30+
}
31+
32+
output "litellm_access_key_id" {
33+
description = "The access key ID for the LiteLLM IAM user"
34+
value = aws_iam_access_key.litellm.id
35+
sensitive = false
36+
}
37+
38+
output "litellm_access_key_secret" {
39+
description = "The access key secret for the LiteLLM IAM user"
40+
value = aws_iam_access_key.litellm.secret
41+
sensitive = true
3042
}

terraform/variables.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ variable "tags" {
2626
variable "environment_suffix" {
2727
description = "Suffix to append to resource names"
2828
type = string
29-
default = "dev"
3029
}

0 commit comments

Comments
 (0)