openclaw/workers/clawdbot-aws/terraform/ecr.tf
Shunsuke Hayashi f56c9d712a feat(aws): add ECS Fargate deployment for Clawdbot Discord bot
- 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>
2026-01-26 12:31:23 +09:00

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"
}
}]
})
}