Provides a Batch Job Definition resource.

Example Usage

resource "aws_batch_job_definition" "test" {
    name = "tf_test_batch_job_definition"
    type = "container"
    container_properties = <<CONTAINER_PROPERTIES
    "command": ["ls", "-la"],
    "image": "busybox",
    "memory": 1024,
    "vcpus": 1,
    "volumes": [
        "host": {
          "sourcePath": "/tmp"
        "name": "tmp"
    "environment": [
        {"name": "VARNAME", "value": "VARVAL"}
    "mountPoints": [
          "sourceVolume": "tmp",
          "containerPath": "/tmp",
          "readOnly": false
    "ulimits": [
        "hardLimit": 1024,
        "name": "nofile",
        "softLimit": 1024

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the job definition.
  • container_properties - (Optional) A valid container properties provided as a single valid JSON document. This parameter is required if the type parameter is container.
  • parameters - (Optional) Specifies the parameter substitution placeholders to set in the job definition.
  • retry_strategy - (Optional) Specifies the retry strategy to use for failed jobs that are submitted with this job definition. Maximum number of retry_strategy is 1. Defined below.
  • timeout - (Optional) Specifies the timeout for jobs so that if a job runs longer, AWS Batch terminates the job. Maximum number of timeout is 1. Defined below.
  • type - (Required) The type of job definition. Must be container


retry_strategy supports the following:

  • attempts - (Optional) The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts.


timeout supports the following:

  • attempt_duration_seconds - (Optional) The time duration in seconds after which AWS Batch terminates your jobs if they have not finished. The minimum value for the timeout is 60 seconds.

Attribute Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name of the job definition.
  • revision - The revision of the job definition.

© 2018 HashiCorpLicensed under the MPL 2.0 License.