title: Terraform variable list of key value pairs for environment variables of batch job
body: <p>I've specified a batch job as:</p>
  
  <pre><code>resource "aws_batch_job_definition" "batch_job" {
    name = "${var.name}"
    type = "container"
  
    container_properties = &lt;&lt;CONTAINER_PROPERTIES
  {
      "command": ["${var.command_first}", "${var.command_second}"],
      "image": "${var.image_repo}:${var.image_tag}",
      "memory": ${var.memory},
      "vcpus": 1,
      "jobRoleArn": "${var.job_role_arn}",
      "environment": "${var.environment}"
  
  }
  CONTAINER_PROPERTIES
  }
  </code></pre>
  
  <p>where var.environment comes from the input variable </p>
  
  <pre><code>variable "environment" {
  }
  </code></pre>
  
  <p>which in my terraform values file I have as</p>
  
  <pre><code>environment = {
  [
        {"name" : "AWS_DEFAULT_REGION",  "value" : "region-val"}
    ]
  }
  </code></pre>
  
  <p>But it doesn't like that format.</p>
  
  <p>If I specify the batch job like this:</p>
  
  <pre><code>resource "aws_batch_job_definition" "batch_job" {
    name = "${var.name}"
    type = "container"
  
    container_properties = &lt;&lt;CONTAINER_PROPERTIES
  {
      "command": ["${var.command_first}", "${var.command_second}"],
      "image": "${var.image_repo}:${var.image_tag}",
      "memory": ${var.memory},
      "vcpus": 1,
      "jobRoleArn": "${var.job_role_arn}",
      "environment":  [
        {"name" : "AWS_DEFAULT_REGION",  "value" : "region-val"}
    ]
  
  }
  CONTAINER_PROPERTIES
  }
  </code></pre>
  
  <p>it works so the issue is when I move this to the variables file it doesn't work. </p>
  
  <p>What should the format be and how should it be used it the batch job definition?</p>
  
  <p>Thanks!</p>