How can I use a list instead of dynamic blocks?

Dynamic blocks can make things very verbose, especially when defining the same thing multiple times.

In this case, I have a list of volumes like so (as a local var):

locals {
    files_staging = {
      name = var.file_staging_bucket
      docker_volume_configuration = [{
        scope         = "shared"
        autoprovision = false
        driver        = "rexray/s3fs"
    files_store = {
      name = var.file_store
      efs_volume_configuration = [{
        file_system_id =

The most logical way to then assign those variables to a resource (eg an aws_ecs_task_definition) would be to provide an array to the volume parameter:

 volume = [

Nice, short, and obvious.

However, it seems that is no longer supported, as Terraform expects the Block parameter instead An argument named "volume" is not expected here. Did you mean to define a block of type "volume"?.

The only way I seem to be able to wrangle dynamic nested blocks into doing what I want is like this:

  dynamic "volume" {
    for_each = ["files_staging", "files_store", "secrets"]
    content { 
      name = volume.value
      dynamic "docker_volume_configuration" {
        for_each = lookup(local.container_volumes[volume.value], "docker_volume_configuration", [])
        content {
          scope = docker_volume_configuration.value.scope
          autoprovision = docker_volume_configuration.value.autoprovision
          driver = docker_volume_configuration.value.driver
      dynamic "efs_volume_configuration" {
        for_each = lookup(local.container_volumes[volume.value], "efs_volume_configuration", [])
        content {
          file_system_id = efs_volume_configuration.value.file_system_id

… which ends up longer than the original thing I was trying to make shorter :frowning:

Is there any way to make this less verbose? I’d really like to just be able to set the var. From my understanding, block attributes just act as a list under the hood anyway.