terraform v0.11 - 无效或未知密钥:efs_volume_configuration

terraform v0.11 - invalid or unknown key: efs_volume_configuration

只是想问一下您是否知道 terraform 代码块中缺少的内容:

resource "aws_ecs_task_definition" "task_definition" {
  family                   = "${lower(var.MY_FAMILY_ID)}-${lower(var.TYPE)}}-efs"
  network_mode             = "awsvpc"
  cpu                      = var.CPU
  memory                   = var.MEMORY
  requires_compatibilities = ["FARGATE"]
  container_definitions    = data.template_file.ecs_template.rendered
  execution_role_arn       = data.iam_role.ecs_role.arn
  task_role_arn            = data.iam_role.ecs_role.arn
  

volume {
      name  = "my-volume"
      efs_volume_configuration {
        file_system_id = data.aws_efs_file_system.efs.id
        root_directory          = "/pogi"
      }
  }
}

上面的 Terraform 代码已经过验证,可以在 Terraform v0.14 上运行,但是当尝试在 Terraform v0.11 上使用时,它会显示此消息。

Error: aws_ecs_task_definition.ecs_task_definition: volume.0: invalid or unknown key: efs_volume_configuration

efs_volume_configuration 已添加到 v2.68.0 of AWS provider. Thus you must upgrade 您的 AWS 供应商至少该版本。