Created
March 10, 2020 15:45
-
-
Save AndrewBestbier/79c0d4f590a137d3c406a95ff6b982e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_ecs_task_definition" "my_first_task" { | |
family = "my-first-task" # Naming our first task | |
container_definitions = <<DEFINITION | |
[ | |
{ | |
"name": "my-first-task", | |
"image": "${aws_ecr_repository.my_first_ecr_repo.repository_url}", | |
"essential": true, | |
"portMappings": [ | |
{ | |
"containerPort": 3000, | |
"hostPort": 3000 | |
} | |
], | |
"memory": 512, | |
"cpu": 256 | |
} | |
] | |
DEFINITION | |
requires_compatibilities = ["FARGATE"] # Stating that we are using ECS Fargate | |
network_mode = "awsvpc" # Using awsvpc as our network mode as this is required for Fargate | |
memory = 512 # Specifying the memory our container requires | |
cpu = 256 # Specifying the CPU our container requires | |
execution_role_arn = "${data.aws_iam_role.ecs_task_execution_role.arn}" | |
} | |
data "aws_iam_role" "ecs_task_execution_role" { | |
name = "ecsTaskExecutionRole" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment