title: Terraform - Creating elastic container service with efs file system: check that your file system ID is correct
body: <p>For persisting container data I want to use an EFS with my docker containers. The launch type for the ECS task is fargate. I get the following error when launching the task:</p>
  <blockquote>
  <p>ResourceInitializationError: failed to invoke EFS utils commands to set up EFS volumes: stderr: Failed to resolve &quot;fs-xxxxxx.efs.eu-central-1.amazonaws.com&quot; - check that your file system ID is correct.</p>
  </blockquote>
  <p>and my task definition looks like this:</p>
  <pre><code>locals {
    username = jsondecode(data.aws_secretsmanager_secret_version.wordpress.secret_string)[&quot;username&quot;]
    password = jsondecode(data.aws_secretsmanager_secret_version.wordpress.secret_string)[&quot;password&quot;]
  }
  
  resource &quot;aws_cloudwatch_log_group&quot; &quot;main&quot; {
    name = &quot;/ecs/wordpress-task&quot;
  }
  
  
  resource &quot;aws_ecs_task_definition&quot; &quot;wordpress&quot; {
    family = &quot;wordpress&quot;
  
    volume {
      name = &quot;wp&quot;
      efs_volume_configuration {
        file_system_id = aws_efs_file_system.wordpress.id
        root_directory = &quot;/wp&quot;
        transit_encryption = &quot;DISABLED&quot;
      }
    }
  
    volume {
      name = &quot;db&quot;
      efs_volume_configuration {
        file_system_id = aws_efs_file_system.wordpress.id
        root_directory = &quot;/db&quot;
        transit_encryption = &quot;DISABLED&quot;
      }
    }
  
    network_mode = &quot;awsvpc&quot;
    requires_compatibilities = [&quot;FARGATE&quot;]
    execution_role_arn =  aws_iam_role.ecs_task_execution_role.arn
    task_role_arn = aws_iam_role.ecs_task_role.arn
    cpu = 1024
    memory = 3072
  
    container_definitions = jsonencode([{
      name = &quot;wordpress&quot;
      image = &quot;wordpress&quot;
      essential = true
      cpu = 256
      memory = 512
      entryPoint = [ &quot;sh&quot;, &quot;-c&quot;]
      command = [&quot;ls -la /var/www/html&quot;]
      mountPoints = [{
        sourceVolume = &quot;wp&quot;
        containerPath = &quot;/var/www/html&quot;
        readOnly = false
      }]
      environment = [{
        name = &quot;WORDPRESS_DB_HOST&quot;
        value = &quot;127.0.0.1&quot;}, 
      {
        name = &quot;WORDPRESS_DB_USER&quot;
        value = local.username
      },
      { 
        name = &quot;WORDPRESS_DB_PASSWORD&quot;
        value = local.password
      },
      {
        name = &quot;WORDPRESS_DB_NAME&quot;
        value = &quot;wordpressdb&quot;
      }]
      portMappings = [{
        protocol = &quot;tcp&quot;
        containerPort = 80
        hostPort = 80
      }]
      logConfiguration = {
        logDriver = &quot;awslogs&quot;
        options = {
          awslogs-group         = aws_cloudwatch_log_group.main.name
          awslogs-stream-prefix = &quot;ecs&quot;
          awslogs-region        = &quot;eu-central-1&quot;
        }}
    },
    {
      name = &quot;db&quot;
      image = &quot;mysql&quot;
      cpu = 256
      memory = 512
      essential = true
      environment = [{
        name = &quot;MYSQL_DATABASE&quot;
        value = &quot;wordpressdb&quot;}, 
      {
        name = &quot;MYSQL_USER&quot;
        value = local.username
      },
      {
        name = &quot;MYSQL_PASSWORD&quot;
        value = local.password
      }, 
      {
        name = &quot;MYSQL_RANDOM_ROOT_PASSWORD&quot;
        value = &quot;1&quot;
      }]
      mountPoints = [{
        sourceVolume = &quot;db&quot;
        containerPath = &quot;/var/lib/mysql&quot;
        readOnly = false
      }]
      portMappings = [{
        containerPort = 3306
        hostPort = 3306
      }]
      logConfiguration = {
        logDriver = &quot;awslogs&quot;
        options = {
          awslogs-group         = aws_cloudwatch_log_group.main.name
          awslogs-stream-prefix = &quot;ecs&quot;
          awslogs-region        = &quot;eu-central-1&quot;
        }
    }}
    ])
  }
  </code></pre>
  <p>The efs system is located in eu-central-1 and is defined like this:</p>
  <pre><code>resource &quot;aws_efs_file_system&quot; &quot;wordpress&quot; {
      creation_token = &quot;wordpress&quot;
  }
  </code></pre>
  <p>I really want to get this working and online resources regarding this issue are very vague.</p>