- Create VPC with public subnets for outbound internet access - Create ECR repository for container images - Create IAM roles (Task Role with DynamoDB/S3 access, Execution Role) - Create ECS Task Definition (Fargate, 2048 MB memory, 256 CPU) - Create ECS Service (1 desired count) - Create CloudWatch Log Group - Add Security Group (outbound only for Discord bot) - Update Dockerfile with .buildstamp to prevent runtime rebuild - Add .env.example with Discord webhook and channel configurations - Update .gitignore to exclude Terraform state files Co-Authored-By: Claude <noreply@anthropic.com>
37 lines
752 B
HCL
37 lines
752 B
HCL
/**
|
|
* Amazon ECR Repository for Clawdbot Container Images
|
|
*/
|
|
|
|
resource "aws_ecr_repository" "clawdbot" {
|
|
name = "${var.project_name}/bot"
|
|
image_tag_mutability = "MUTABLE"
|
|
|
|
image_scanning_configuration {
|
|
scan_on_push = true
|
|
}
|
|
|
|
tags = {
|
|
Name = "${var.project_name}-ecr"
|
|
}
|
|
}
|
|
|
|
# ECR Lifecycle Policy (keep last 10 images)
|
|
resource "aws_ecr_lifecycle_policy" "clawdbot" {
|
|
repository = aws_ecr_repository.clawdbot.name
|
|
|
|
policy = jsonencode({
|
|
rules = [{
|
|
rulePriority = 1
|
|
description = "Keep last 10 images"
|
|
selection = {
|
|
tagStatus = "any"
|
|
countType = "imageCountMoreThan"
|
|
countNumber = 10
|
|
}
|
|
action = {
|
|
type = "expire"
|
|
}
|
|
}]
|
|
})
|
|
}
|