Reputation: 335
We are using terraform to import a ECS solution and for some reason, I can not get pass this error.
aws_ecs_task_definition.clustername: ClientException: Container.name should not be null or empty. 09-Feb-2017 23:35:1 status code: 400
I believe this is coming form this json file, service-prod-server.json
#aws_ecs_task_definition
resource "aws_ecs_task_definition" "cluster-name" {
family = "cluster-name"
container_definitions = "${file("task-definitions/service-prod-server.json")}"
}
Here is the top portion of the service-prod-server.json config. I have the name there.
[
{
"name": "containername",
"memory": 7000,
"image": "imagename",
"disableNetworking": false,
"readonlyRootFilesystem": false,
I also have this config defined as well.
#aws_ecs_container_definition
data "aws_ecs_container_definition" "cluster-name" {
task_definition = "${aws_ecs_task_definition.cluster-name.id}"
container_name = "containername"
}
Let me know what you guys think
Upvotes: 4
Views: 7214
Reputation: 537
For me, I labeled the environment variable key incorrectly:
{ "key": "myvariable", "value": "myvalue" }
instead of
{ "name": "myvariable", "value": "myvalue" }
The difference is that I wrote key
instead of name
and that broke the whole container definition, which gave me this error.
Upvotes: 10
Reputation: 1273
For what it's worth, I got this same error in Terraform when trying to pass an entire task definition to container_definitions
. Note that the container_definitions
option should only be set to the containerDefinitions section of the task definition (not the entire thing).
Upvotes: 8