I have done troubleshooting because in my opinion could be a terraform bug, or a Jose bug 
troubleshooting
##############################
instead of have a dynamic value i have replaced EFS_ID= “${module.instancias_efs.aws_efs_file_system_efs_system_id}”
i am going to use existing values
EFS_ID= “fs-ca141b3b”
#################################
module “fargate” {
source = “…/…/source/modulos/fargate”
EFS_ID= "fs-ca141b3b"
com_mount = 0
sem_mount = 1
nometaskdefenition = “ldap_cross”
vpc_ldap_id_p = “{module.redes.vpc_cross_id}"
fargate_cpu = "2"
fargate_memory = "512"
app_image = "920768381054.dkr.ecr.eu-west-2.amazonaws.com/opendj-ldap:1.0.2"
subnet_id = "{module.redes.aws_subnet_publica_aza_id}”
}
the error still the same
fications complete after 1s [id=arn:aws:ecs:eu-west-2:920768381054:service/80/ldap_cross]
Error: InvalidParameter: 1 validation error(s) found.
- missing required field, RegisterTaskDefinitionInput.Volumes[0].EfsVolumeConfiguration.FileSystemId.
#############################
other approach just to troubleshooting, if i replace the EFS id directly in the resource.
so instead of var.EFS_ID, i will put
( i had replaced var by a real value)
file_system_id = fs-ca141b3b
#################
resource “aws_ecs_task_definition” “ldap” {
family = var.nometaskdefenition
network_mode = “awsvpc”
requires_compatibilities = [“FARGATE”]
cpu = “256”
memory = “512”
task_role_arn = “arn:aws:iam::920768381054:role/ecs-task-definition-role”
execution_role_arn = “arn:aws:iam::920768381054:role/ecs-task-definition-role”
container_definitions = <<DEFINITION
[…]
DEFINITION
volume {
name = “efs_temp”
efs_volume_configuration {
file_system_id = var.EFS_ID
root_directory = "/"
}
}
}
So if i put way a variable, it works.
working solution but not desirable solution ( i replace manual the real values instead of have a variable
############################
working solution without variable ( not desirable )
##################################
resource “aws_ecs_task_definition” “ldap” {
family = var.nometaskdefenition
network_mode = “awsvpc”
requires_compatibilities = [“FARGATE”]
cpu = “256”
memory = “512”
task_role_arn = “arn:aws:iam::920768381054:role/ecs-task-definition-role”
execution_role_arn = “arn:aws:iam::920768381054:role/ecs-task-definition-role”
container_definitions = <<DEFINITION
[…]
DEFINITION
volume {
name = “efs_temp”
efs_volume_configuration {
file_system_id = "fs-ca141b3b"
root_directory = "/"
}
}
}
Apply complete! Resources: 3 added, 1 changed, 0 destroyed.
but is is funny, because if i put ( without “”) file_system_id = fs-ca141b3b, it does not work we should put file_system_id = “fs-ca141b3b”
So my question it is:
file_system_id = var.EFS_ID should be used “” file_system_id = “var.EFS_ID”. it does not work like this.
So have you an solution ?
thanks a lot