mirror of
https://github.com/karpathy/nanochat.git
synced 2026-05-12 02:40:17 +00:00
Add reusable Terraform modules and per-environment configs (dev/uat/prod) in us-west-2 covering: VPC (3 AZ public/private), EKS 1.29 with IRSA and ALB/EBS/EFS CSI add-ons, RDS PostgreSQL 15, four ECR repos, IAM roles (EKS node, ALB controller IRSA, GitHub Actions OIDC), Route53 + ACM for samosachaat.art, and EFS for model weights. State backend on S3 (samosachaat-terraform-state) with DynamoDB lock table. terraform validate passes for dev, uat, and prod. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
51 lines
948 B
HCL
51 lines
948 B
HCL
terraform {
|
|
required_version = ">= 1.5.0"
|
|
required_providers {
|
|
aws = {
|
|
source = "hashicorp/aws"
|
|
version = ">= 5.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "aws_ecr_repository" "this" {
|
|
for_each = toset(var.repository_names)
|
|
|
|
name = each.key
|
|
image_tag_mutability = "MUTABLE"
|
|
force_delete = var.force_delete
|
|
|
|
image_scanning_configuration {
|
|
scan_on_push = true
|
|
}
|
|
|
|
encryption_configuration {
|
|
encryption_type = "AES256"
|
|
}
|
|
|
|
tags = var.tags
|
|
}
|
|
|
|
resource "aws_ecr_lifecycle_policy" "keep_last_20" {
|
|
for_each = aws_ecr_repository.this
|
|
|
|
repository = each.value.name
|
|
|
|
policy = jsonencode({
|
|
rules = [
|
|
{
|
|
rulePriority = 1
|
|
description = "Keep only the last 20 images"
|
|
selection = {
|
|
tagStatus = "any"
|
|
countType = "imageCountMoreThan"
|
|
countNumber = 20
|
|
}
|
|
action = {
|
|
type = "expire"
|
|
}
|
|
}
|
|
]
|
|
})
|
|
}
|