We are using Terraform to dynamically spin up an AWS ECS/Fargate container to run a Spring Boot Application and there is a requirement to pass several command line arguments into the application. The available documentation seems to suggest that the correct way to do this is to define a "command" block in the Terraform container definition JSON and specify one or more arguments there. Here is my current container definition:
[{
"name": "${environment}-${app_name}",
"image": "${app_image}",
"cpu": ${fargate_cpu},
"memory": ${fargate_memory},
"networkMode": "awsvpc",
"command": [
"--server.port",
"${app_port}"
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${environment}-${app_name}",
"awslogs-region": "${aws_region}",
"awslogs-stream-prefix": "ecs"
}
},
"portMappings": [
{
"containerPort": ${app_port},
"hostPort": ${app_port}
}
]}]
You will note that I've defined the command block with the argument --server.port and set its value to the app_port variable. However on deployment this argument is not picked up by the Spring Boot application running inside the container and default port is used instead.
My question is simply: how should one go about specifying command line arguments to applications running inside Fargate containers?