title: How do I create a folder on EFS?
body: <p>I set up an ECS Cluster with Terraform. Everything works great, but I have a few questions about it.</p>
  <p><strong>1.</strong> As far as I understood, an EFS volume doesn't need to be mounted to ECS instances. AWS allows us to mount an EFS volume folder directly to a container. Am I right?</p>
  <pre><code>resource &quot;aws_ecs_task_definition&quot; &quot;Task&quot; {
    family                = var.ServiceName
    container_definitions = file(&quot;service.json&quot;)
    tags = {
      Name    = data.terraform_remote_state.Cluster.outputs.TagName
      Project = data.terraform_remote_state.Cluster.outputs.TagName
    }
    volume {
      name = &quot;service-storage&quot;
      efs_volume_configuration {
        file_system_id = data.terraform_remote_state.Cluster.outputs.EfsVolumeId
        root_directory = &quot;/&quot;
      }
    }
  }
  </code></pre>
  <p><code>root_directory</code> here is the path inside of the EFS volume to the folder, which will be mounted to a container.</p>
  <p><em>service.json</em></p>
  <pre><code>[
    {
      &quot;name&quot;: &quot;nginx13&quot;,
      &quot;image&quot;: &quot;nginx&quot;,
      &quot;memory&quot;: 256,
      &quot;mountPoints&quot;: [
        {
          &quot;containerPath&quot;: &quot;/usr/share/nginx/html&quot;,
          &quot;sourceVolume&quot;: &quot;service-storage&quot;
        }
      ],
      &quot;portMappings&quot;: [
        {
          &quot;containerPort&quot;: 80
        }
      ]
    }
  ]
  </code></pre>
  <p><code>containerPath</code> here is the path inside of the container to the mount point where the <code>root_directory</code> folder will be mounted. So there is no parameter related to an ECS instance mount point or path to it.</p>
  <p><strong>2.</strong> Before I create a new task, I need to create a folder on the EFS volume to mount containers to it later. Now, I can use only the root folder of the EFS volume because it is empty. So, I am looking for a way to manage creating and deleting folders on EFS volumes with a terraform template. And this is the first part of the problem, the second part is to put files in that folder.
  What are the best practices for that? Should I use some kind of deployment solution like Jenkins or it could be done just with Terraform? What about the EFS folder permissions? Do they need to be changed?</p>