Skip to content

Instantly share code, notes, and snippets.

@david7482
Last active July 16, 2020 01:30
Show Gist options
  • Save david7482/82774f0a34797e9e2759fd204596ede7 to your computer and use it in GitHub Desktop.
Save david7482/82774f0a34797e9e2759fd204596ede7 to your computer and use it in GitHub Desktop.
module "container_definition" {
source = "github.com/cloudposse/terraform-aws-ecs-container-definition?ref=0.23.0"
container_name = "filebrowser"
container_image = "david7482/filebrowser"
essential = "true"
port_mappings = [
{
protocol = "tcp"
containerPort = 80
hostPort = 80
},
]
mount_points = [
{
containerPath = "/srv"
sourceVolume = "efs"
},
]
}
resource "aws_ecs_task_definition" "main" {
family = "filebrowser"
execution_role_arn = aws_iam_role.service_task_execution_role.arn
task_role_arn = aws_iam_role.service_task_execution_role.arn
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = 256
memory = 512
container_definitions = "[${module.container_definition.json_map}]"
volume {
name = "efs"
efs_volume_configuration {
file_system_id = aws_efs_file_system.efs.id
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment