terraform main.tf
file:main.tf
resource "aws_ecs_cluster" "example-ecscluster-fargate" { name = "example-ecscluster-farget" } resource "aws_ecs_task_definition" "example-ecs-task-fargate-web" { family = "example-fargate" cpu = "256" memory = "512" network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] container_definitions = file("./container_definitions.json") }
file:container_definitions.json
[ { "name": "example-container-web-nginx", "image": "nginx:latest", "essential": true, "portMappings": [ { "protocol": "tcp", "containerPort": 80 } ] } ]