You must be logged in to view saved presets
Defines and deploys a MongoDB service on AWS ECS using a specific task definition.
data "aws_ecs_task_definition" "mongo" {
task_definition = aws_ecs_task_definition.mongo.family
}
resource "aws_ecs_cluster" "foo" {
name = "foo"
}
resource "aws_ecs_service" "mongo" {
cluster = aws_ecs_cluster.foo.id
desired_count = 2
name = "mongo"
task_definition = data.aws_ecs_task_definition.mongo.arn
}
resource "aws_ecs_task_definition" "mongo" {
container_definitions = <<-EOF
[
{
"cpu": 128,
"environment": [{
"name": "SECRET",
"value": "KEY"
}],
"essential": true,
"image": "mongo:latest",
"memory": 128,
"memoryReservation": 64,
"name": "mongodb"
}
]
EOF
family = "mongodb"
}