infra/infra/alpha.tf

61 lines
1.7 KiB
HCL

# Alpha houses all of our containerized applications
# Essentially it is a cluster with services that we
# choose to expose to the internet in one form or another
# Logging Configuration for services inside the cluster
#######################################################
resource "aws_cloudwatch_log_group" "alpha" {
name = "alpha-log"
}
# Alpha cluster definition
###########################
resource "aws_ecs_cluster" "alpha" {
name = "alpha"
configuration {
execute_command_configuration {
log_configuration {
cloud_watch_log_group_name = aws_cloudwatch_log_group.alpha.name
}
}
}
}
# Lewdlad Service Definition
############################
resource "aws_ecs_task_definition" "lewdlad" {
family = "lewdlad-task-definition"
container_definitions = jsonencode([
{
name = "lewdlad-container"
image = "registry.gitlab.com/shockrah/left-coast-server-bot:latest"
# Literally the smallest amount that fargate will allow
cpu = 256
memory = 512
essential = true
environment = [
{ name: DISCORD_ID, value: var.DISCORD_ID },
{ name: DISCORD_TOKEN, value: var.DISCORD_TOKEN },
{ name: AWS_API_ID, value: var.AWS_API_ID },
{ name: AWS_API_STAGE, value: var.AWS_API_STAGE },
{ name: AWS_API_REGION, value: var.AWS_API_REGION },
{ name: AWS_API_KEY, value: var.AWS_API_KEY },
{ name: DEV_GUILD_ID, value: var.DEV_GUILD_ID },
{ name: BEEHIVE_ID, value: var.BEEHIVE_ID },
]
}
])
}
resource "aws_ecs_service" "lewdlad" {
name = "lewdlad"
cluster = aws_ecs_cluster.alpha.arn
task_definition = aws_ecs_task_definition.lewdlad.arn
desired_count = 1
}