AWS ECS Task Definition with terraform and efs - Unknown volume
Your volumes
definition isn't supposed to be inside container_definitions
but is part of aws_ecs_task_definition
resource arguments.
So, you should move this part outside:
volumes = [{ name = "wordpress-volume" efsVolumeConfiguration = { fileSystemId = aws_efs_file_system.wordpress.id } }]
to
resource "aws_ecs_task_definition" "wordpress" {... volume { name = "wordpress-volume" efs_volume_configuration { file_system_id = aws_efs_file_system.wordpress.id } }...}
see the docs:
- https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition#volume-block-arguments
- https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TaskDefinition.html
And container definition docs: