Skip to content

Terraform module that generates the container properties object to use in AWS Batch.

License

Notifications You must be signed in to change notification settings

karvounis/terraform-aws-batch-container-properties

Repository files navigation

terraform-aws-batch-container-properties

terraform aws pre-commit GitHub tag (latest SemVer) GitHub Release Date GitHub

Terraform module that generates the container properties object to use in AWS Batch.

AWS Documentation

Fast-tracked using Simple Terraform Template.

README file is autogenerated using terraform-docs!

Support

If you like my work, please consider supporting it!

buy-me-coffee liberapay Support with Bitcoin Support with Ethereum

Cheers!

Terraform documentation

Requirements

Name Version
terraform >= 0.12.0

Providers

No provider.

Inputs

Name Description Type Default Required
command The command that's passed to the container. This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run. For more information, see https://docs.docker.com/engine/reference/builder/#cmd. list(string) [] no
environment The environment variables to pass to the container. This is a list of maps. https://docs.aws.amazon.com/batch/latest/APIReference/API_KeyValuePair.html
list(object({
name = string
value = string
}))
[] no
execution_role_arn The Amazon Resource Name (ARN) of the execution role that AWS Batch can assume. Jobs running on Fargate resources must provide an execution role. https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html string null no
fargate_platform_configuration The platform configuration for jobs running on Fargate resources. Jobs running on EC2 resources must not specify this parameter. https://docs.aws.amazon.com/batch/latest/APIReference/API_FargatePlatformConfiguration.html
object({
platform_version = string
})
null no
image The image used to start a container. This string is passed directly to the Docker daemon. Images in the Docker Hub registry are available by default. Other repositories are specified with repository-url/image:tag . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed string n/a yes
instance_type The instance type to use for a multi-node parallel job. All node groups in a multi-node parallel job must use the same instance type. string null no
job_role_arn The Amazon Resource Name (ARN) of the IAM role that the container can assume for AWS permissions. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html string null no
linux_parameters Linux-specific modifications that are applied to the container, such as Linux kernel capabilities. For more details, see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_LinuxParameters.html
object({
capabilities = object({
add = list(string)
drop = list(string)
})
devices = list(object({
containerPath = string
hostPath = string
permissions = list(string)
}))
initProcessEnabled = bool
maxSwap = number
sharedMemorySize = number
swappiness = number
tmpfs = list(object({
containerPath = string
mountOptions = list(string)
size = number
}))
})
null no
log_configuration The log configuration specification for the container. https://docs.aws.amazon.com/batch/latest/APIReference/API_LogConfiguration.html
object({
logDriver = string
options = map(string)
secretOptions = list(object({
name = string
valueFrom = string
}))
})
null no
memory This parameter is deprecated and not supported for jobs run on Fargate resources, use ResourceRequirement. For jobs run on EC2 resources can specify the memory requirement using the ResourceRequirement structure. The hard limit (in MiB) of memory to present to the container. If your container attempts to exceed the memory specified here, the container is killed. This parameter maps to Memory in the Create a container section of the Docker Remote API and the --memory option to docker run. You must specify at least 4 MiB of memory for a job. This is required but can be specified in several places; it must be specified for each node at least once. number n/a yes
mount_points The mount points for data volumes in your container. This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run. https://docs.aws.amazon.com/batch/latest/APIReference/API_MountPoint.html
list(object({
containerPath = string
sourceVolume = string
readOnly = bool
}))
[] no
network_configuration The network configuration for jobs running on Fargate resources. Jobs running on EC2 resources must not specify this parameter. https://docs.aws.amazon.com/batch/latest/APIReference/API_NetworkConfiguration.html
object({
assignPublicIp = string
})
null no
privileged When this variable is true, the container is given elevated privileges on the host container instance (similar to the root user). This parameter is not supported for Windows containers or tasks using the Fargate launch type. bool null no
readonly_root_filesystem When this parameter is true, the container is given read-only access to its root file system. This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run. bool null no
resource_requirements The type and amount of resources to assign to a container. The supported resources include GPU, MEMORY, and VCPU. https://docs.aws.amazon.com/batch/latest/APIReference/API_ResourceRequirement.html
list(object({
type = string
value = string
}))
[] no
secrets The secrets for the container. https://docs.aws.amazon.com/batch/latest/APIReference/API_Secret.html
list(object({
name = string
valueFrom = string
}))
[] no
ulimits A list of ulimits to set in the container. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run. This parameter isn't applicable to jobs running on Fargate resources and shouldn't be provided.
list(object({
name = string
hardLimit = number
softLimit = number
}))
[] no
user The user name to use inside the container. This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run. string null no
vcpus This parameter is deprecated and not supported for jobs run on Fargate resources, see resourceRequirement. The number of vCPUs reserved for the container. Jobs running on EC2 resources can specify the vCPU requirement for the job using resourceRequirements but the vCPU requirements can't be specified both here and in the resourceRequirement structure. This parameter maps to CpuShares in the Create a container section of the Docker Remote API and the --cpu-shares option to docker run. Each vCPU is equivalent to 1,024 CPU shares. You must specify at least one vCPU. This is required but can be specified in several places. It must be specified for each node at least once. number n/a yes
volumes A list of data volumes used in a job. https://docs.aws.amazon.com/batch/latest/APIReference/API_Volume.html
list(object({
host = object({
sourcePath = string
})
name = string
}))
[] no

Outputs

Name Description
json_map_encoded JSON string encoded container properties.
json_map_encoded_list JSON string encoded list of container properties.
json_map_object JSON map encoded container properties.