Terraform module to deploy AWS Batch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Charles CÈBE 73fb09c81a Merge pull request 'Release 1.0.0: maintenance/bump_versions' (#8) from maintenance/bump_versions into master 1 month ago
examples/default refactor: least provider versions 1 month ago
.gitignore feat: init 8 months ago
.pre-commit-config.yaml chore: bumps pre-commit hooks versions 2 months ago
CHANGELOG.md refactor: least provider versions 1 month ago
Jenkinsfile feat: init 8 months ago
LICENSE feat: init 8 months ago
README.md refactor: least provider versions 1 month ago
data.tf fix: auto-select correct VPC for security group 7 months ago
main.tf refactor: least provider versions 1 month ago
outputs.tf refactor: least provider versions 1 month ago
variables.tf refactor: least provider versions 1 month ago
versions.tf refactor: least provider versions 1 month ago

README.md

terraform-module-aws-batch

Terraform module to deploy Batch on AWS.

Requirements

Name Version
terraform >= 0.14
aws >= 3.0

Providers

Name Version
aws >= 3.0

Modules

No modules.

Resources

Name Type
aws_batch_compute_environment.this resource
aws_batch_job_queue.this resource
aws_iam_instance_profile.ecs_instance_role resource
aws_iam_role.ecs_instance_role resource
aws_iam_role.service_role resource
aws_iam_role.service_role_spot resource
aws_iam_role_policy_attachment.additional_policy resource
aws_iam_role_policy_attachment.ecs_additional_policy resource
aws_iam_role_policy_attachment.ecs_instance_role resource
aws_iam_role_policy_attachment.service_role resource
aws_iam_role_policy_attachment.service_role_spot resource
aws_iam_service_linked_role.spot resource
aws_iam_service_linked_role.spotfleet resource
aws_security_group.instances resource
aws_security_group_rule.instances_egress_open resource
aws_iam_policy_document.sts_batch data source
aws_iam_policy_document.sts_ec2 data source
aws_iam_policy_document.sts_spotfleet data source
aws_subnet.this data source

Inputs

Name Description Type Default Required
additional_iam_policy_arns add additional policy arns to service role list(string)
[
““
]
no
attach_additional_policy whether to add additional polices or not bool false no
compute_environment_arns (Needed if compute_environment_create == false) Specifies the set of compute environments (ARNs) mapped to a job queue and their order. The position of the compute environments in the list will dictate the order. You can associate up to 3 compute environments with a job queue list(string) [] no
compute_environment_create Whether or not to create a compute environment for Batch bool true no
compute_environment_enabled Whether or not to enable the compute environment (toggles compute_environment.state ENABLED/DISABLED.). bool true no
compute_environment_managed Whether or not to manage the compute environment (toggles compute_environment.type MANAGED/UNMANAGED). bool true no
compute_environment_name (Optional, Forces new resource) The name for your compute environment. Up to 128 letters (uppercase and lowercase), numbers, hyphens and underscores are allowed. If omitted, Terraform will assign a random, unique name. string null no
compute_environment_name_prefix (Optional, Forces new resource) Creates a unique compute environment name beginning with the specified prefix. Conflicts with compute_environment_name. string null no
compute_environment_tags Key-value map of resource tags for the compute environment (merged with var.tags) map(string) {} no
compute_resource_allocation_strategy The allocation strategy to use for the compute resource in case not enough instances of the best fitting instance type can be allocated. Valid items are BEST_FIT_PROGRESSIVE, SPOT_CAPACITY_OPTIMIZED or BEST_FIT. string "BEST_FIT_PROGRESSIVE" no
compute_resource_bid_percentage Integer of minimum percentage that a Spot Instance price must be when compared with the On-Demand price for that instance type before instances are launched. For example, if your bid percentage is 20% (20), then the Spot price must be below 20% of the current On-Demand price for that EC2 instance. This parameter is required for SPOT compute environments. number null no
compute_resource_desired_vcpus The desired number of EC2 vCPUS in the compute environment. number null no
compute_resource_ec2_key_pair The EC2 key pair that is used for instances launched in the compute environment. string null no
compute_resource_image_id The Amazon Machine Image (AMI) ID used for instances launched in the compute environment string null no
compute_resource_instance_type The instances types that can be launched. You can specify instance families to launch any instance type within those families (for example, c5 or p3), or you can specify specific sizes within a family (such as c5.8xlarge). You can also choose optimal to select instance types (from the C4, M4, and R4 instance families) that match the demand of your job queues. list(string)
[
“c5.large"
]
no
compute_resource_launch_template Launch template configuration for compute environment format: list(object({ launch_template_id = string, version = optional(number) })) list(any) [] no
compute_resource_max_vcpus The maximum number of EC2 vCPUs that an environment can reach. number 16 no
compute_resource_min_vcpus The minimum number of EC2 vCPUs that an environment should maintain. number 0 no
compute_resource_spot_iam_fleet_role (Needed for Spot if service_role_spot_create == false)The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. string null no
compute_resource_subnet_ids A list of VPC subnets into which the compute resources are launched list(string) n/a yes
compute_resource_tags Tags to be used for compute resources (merged with var.tags). map(string) {} no
compute_resource_type The type of compute environment. Valid items are EC2 or SPOT. string "EC2" no
ecs_instance_profile_additional_iam_policy_arns List of IAM policies ARNs to attach to ECS Instance Profile list(string) [] no
ecs_instance_profile_arn (Needed if service_role_create == false) The Amazon ECS instance role applied to Amazon EC2 instances in a compute environment. string null no
ecs_instance_profile_create Whether or not to create instance profile for ECS instances bool true no
ecs_instance_profile_name The IAM profile's name for the EC2 instance (or launch template). If var.ecs_instance_profile_create is true and this is null, Terraform will assign a random, unique name. If var.ecs_instance_profile_create is false this value should be the name of an external IAM Instance Profile. string "BatchEcsInstanceRole" no
ecs_instance_profile_path Path in which to create the Instance Profile for the EC2 instance (or launch template). Instance Profile IAM Role will share the same path. Ignored if var.ecs_instance_profile_create is false. string null no
ecs_instance_role_description Description of the IAM Role to be used by the Instance Profile. Ignored if var.ecs_instance_profile_create is false. string "Instance Profile Role For Batch Instances" no
ecs_instance_role_name Name of the IAM Role to be used by the Instance Profile. If null, Terraform will assign a random, unique name. Ignored if var.ecs_instance_profile_create is false. string "BatchEcsInstanceRole" no
ecs_instance_role_path Path in which to create the Instance Profile for the EC2 instance (or launch template). Instance Profile IAM Role will share the same path. Ignored if var.ecs_instance_profile_create is false. any null no
ecs_instance_role_tags Tags to be used for the Instance Profile Role (merged with var.tags). map(string) {} no
instance_sg_create Whether or not to create Security Group for Batch instances bool true no
instance_sg_ids (Needed if instance_sg_create == false) A list of EC2 security group that are associated with instances launched in the compute environment list(string) [] no
instance_sg_name SG name for Batch instances string "SG for Batch instances" no
instance_sg_tags Tags to be used for the instances SG (merged with var.tags). map(string) {} no
prefix Prefix to be added to with all resource's names of the module. Prefix is mainly used for tests and should remain empty in normal circumstances. string "" no
queue_create Whether or not to create a job queue for Batch bool true no
queue_enabled Whether or not to enable job queue (toggles aws_batch_job_queue.state ENABLED/DISABLED).) bool true no
queue_name Specifies the name of the job queue. string "job-queue" no
queue_priority The priority of the job queue. Job queues with a higher priority are evaluated first when associated with the same compute environment. number 1 no
queue_tags Tags to be used for the job queue (merged with var.tags). map(string) {} no
service_linked_role_spot_create Whether or not to create service role for Spot bool true no
service_linked_role_spot_description Description attached to the service linked role string "Spot service linked role" no
service_linked_role_spotfleet_create Whether or not to create service role for Spot bool true no
service_linked_role_spotfleet_description Description attached to the service linked role string "Spotfleet service linked role" no
service_role_arn (Needed if service_role_create == false) Full Amazon Resource Name (ARN) of the IAM role that allows AWS Batch to make calls to other AWS services on your behalf. string null no
service_role_create Whether or not to create service role for Batch bool true no
service_role_description Description of the IAM Role to be used by the Batch. Ignored if var.service_role_create is false. string "Service Role For Batch" no
service_role_name Instance role name for ECS instances string "BatchServiceRoleEC2" no
service_role_path Path in which to create the service role for Batch. Ignored if var.service_role_create is false. string null no
service_role_spot_create Whether or not to create service role for Spot bool true no
service_role_spot_description Description of the IAM Role to be used by the Batch. Ignored if var.service_role_spot_create is false. string "Service Role Spot For Batch" no
service_role_spot_name Instance role name for ECS instances string "AmazonEC2SpotFleetTaggingRole" no
service_role_spot_path Path in which to create the service role for Batch. Ignored if var.service_role_spot_create is false. string null no
tags Map of tags that will be applied on all resources. map(string) {} no

Outputs

Name Description
batch_compute_environment_arn The Amazon Resource Name (ARN) of the compute environment.
batch_compute_environment_ecs_cluster_arn The Amazon Resource Name (ARN) of the underlying Amazon ECS cluster used by the compute environment.
batch_compute_environment_status The current status of the compute environment (for example, CREATING or VALID).
batch_compute_environment_status_reason A short, human-readable string to provide additional details about the current status of the compute environment.
batch_job_queue_this_arn The Amazon Resource Name of the job queue.
iam_instance_profile_ecs_instance_role_arn The ARN assigned by AWS to the instance profile.
iam_instance_profile_ecs_instance_role_create_date The creation timestamp of the instance profile.
iam_instance_profile_ecs_instance_role_id The instance profile's ID.
iam_instance_profile_ecs_instance_role_name The instance profile's name.
iam_instance_profile_ecs_instance_role_path The path of the instance profile in IAM.
iam_instance_profile_ecs_instance_role_role The role assigned to the instance profile.
iam_instance_profile_ecs_instance_role_unique_id The unique ID assigned by AWS.
iam_role_ecs_instance_role_arn The Amazon Resource Name (ARN) specifying the role.
iam_role_ecs_instance_role_create_date The creation date of the IAM role.
iam_role_ecs_instance_role_description The description of the role.
iam_role_ecs_instance_role_id The name of the role.
iam_role_ecs_instance_role_name The name of the role.
iam_role_ecs_instance_role_unique_id The stable and unique string identifying the role.
iam_role_service_role_arn The Amazon Resource Name (ARN) specifying the role.
iam_role_service_role_create_date The creation date of the IAM role.
iam_role_service_role_description The description of the role.
iam_role_service_role_id The name of the role.
iam_role_service_role_name The name of the role.
iam_role_service_role_spot_arn The Amazon Resource Name (ARN) specifying the role.
iam_role_service_role_spot_create_date The creation date of the IAM role.
iam_role_service_role_spot_description The description of the role.
iam_role_service_role_spot_id The name of the role.
iam_role_service_role_spot_name The name of the role.
iam_role_service_role_spot_unique_id The stable and unique string identifying the role.
iam_role_service_role_unique_id The stable and unique string identifying the role.
security_group_instances_arn The ARN of the security group.
security_group_instances_description The description of the security group.
security_group_instances_egress The egress rules.
security_group_instances_id The ID of the security group.
security_group_instances_ingress The ingress rules.
security_group_instances_name The name of the security group.
security_group_instances_owner_id The owner ID.
security_group_instances_vpc_id The VPC ID.
service_linked_role_spot_arn The Amazon Resource Name (ARN) specifying the role.
service_linked_role_spot_id The Amazon Resource Name (ARN) of the role.
service_linked_role_spot_name The name of the role.
service_linked_role_spot_path The path of the role.
service_linked_role_spot_unique_id The stable and unique string identifying the role.
service_linked_role_spotfleet_arn The Amazon Resource Name (ARN) specifying the role.
service_linked_role_spotfleet_id The Amazon Resource Name (ARN) of the role.
service_linked_role_spotfleet_name The name of the role.
service_linked_role_spotfleet_path The path of the role.
service_linked_role_spotfleet_unique_id The stable and unique string identifying the role.