Skip to content

datadrivers/fx-terraform-module-aws-batch-job

Repository files navigation

terraform-module-aws-batch-job

Terraform module to create and schedule an AWS Batch Job.

This module doesn't create the Batch compute environment, you can call our batch module in order to create it (please take a look at examples/default/).

Requirements

Name Version
terraform >= 0.14
aws >= 3.0

Providers

Name Version
aws >= 3.0

Modules

No modules.

Resources

Name Type
aws_batch_job_definition.this resource
aws_cloudwatch_event_rule.event resource
aws_cloudwatch_event_rule.schedule resource
aws_cloudwatch_event_target.event resource
aws_cloudwatch_event_target.schedule resource
aws_iam_policy.service_role resource
aws_iam_role.execution_role resource
aws_iam_role.service_role resource
aws_iam_role_policy_attachment.execution_role_extras_policies resource
aws_iam_role_policy_attachment.service_role resource
aws_iam_policy_document.events_assume data source
aws_iam_policy_document.events_batch data source
aws_iam_policy_document.tasks_assume data source

Inputs

Name Description Type Default Required
event_pattern The event pattern described a JSON object. At least one of schedule_expression or event_pattern is required. See full documentation of Events and Event Patterns in EventBridge for details. string null no
event_policy_description Description of the IAM policy (var.name will be appended). string "Service Role for EventBridge / Batch Job" no
event_policy_name Name of the policy (_var.name will be appended). string "AWS_Events_Invoke_Batch_Job_Queue" no
event_role_arn When event_role_create == false, external Service Role ARN string null no
event_role_create Whether or not to create IAM resources for EventBridge. bool true no
event_role_description Description of the IAM role (var.name will be appended). string "Service Role for EventBridge / Batch Job" no
event_role_name Name of the role (_var.name will be appended). string "AWS_Events_Invoke_Batch_Job_Queue" no
event_role_path Path in which to create the policy. string "/service-role/" no
event_rule_target_id The unique target assignment ID. Will be prefixed with var.prefix and sufixed by -onsched/onevent. string "batchjob" no
event_rules_bus_name The event bus to associate with this rule. If you omit this, the default event bus is used. string null no
event_rules_create Whether or not to create a EventBridge rule bool true no
event_rules_description The description of the rule. string "Run batch job based on event or schedule" no
event_rules_is_enabled Whether or not to enable EventBridge Rule bool true no
event_rules_name Rule name (will be prefixed with 'var.prefix-job-' and sufixed with '-onsched/onevent'). If null, the rule will use var.name string null no
event_rules_role The Amazon Resource Name (ARN) associated with the role that is used for target invocation. string null no
event_tags Map of tags that will be applied on EventBridge and IAM resources (merged on local.tags, var.tags). map(string) {} no
execution_role_create Whether or not to create the IAM execution role. bool true no
execution_role_description Description of the IAM role for executing task (var.name will be appended). string "Execution role for tasks" no
execution_role_extras_policies Extra policies ARN to attach to the execution role list(string) [] no
execution_role_path Path in which to create the policy for executing task. string "/" no
execution_role_tags Map of tags that will be applied on IAM resources for execution role (merged on local.tags, var.tags). map(string) {} no
job_arn When job_create == false, external job definition ARN string null no
job_create Whether or not to create a job definition bool true no
job_queue_arn External Batch Job Queue ARN string n/a yes
job_tags Map of tags that will be applied on job definition (merged on local.tags, var.tags). map(string) {} no
name Name of your job, will be use by Job definition and EventBridge resources. string n/a yes
parameters (Optional) Specifies the parameter substitution placeholders to set in the job definition. 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
properties A valid container properties provided as a map (see an example here https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/batch_job_definition / container_properties). any n/a yes
retries The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts. number 1 no
schedule_expression The scheduling expression. For example, cron(0 20 * * ? *) or rate(5 minutes). At least one of schedule_expression or event_pattern is required. Can only be used on the default event bus. string null no
tags Map of tags that will be applied on all resources. map(string) {} no
timeout (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. number null no

Outputs

Name Description
arn n/a
execution_role_arn n/a
execution_role_create_date n/a
execution_role_description n/a
execution_role_id n/a
execution_role_name n/a
execution_role_unique_id n/a
revision n/a
rule_event_arn n/a
rule_event_id n/a
rule_schedule_arn n/a
rule_schedule_id n/a
service_policy_arn n/a
service_policy_description n/a
service_policy_id n/a
service_policy_name n/a
service_policy_path n/a
service_policy_policy n/a
service_role_arn n/a
service_role_create_date n/a
service_role_description n/a
service_role_id n/a
service_role_name n/a
service_role_unique_id n/a
target_event_arn n/a
target_schedule_arn n/a

Versioning

This repository follows Semantic Versioning 2.0.0

Git Hooks

This repository uses pre-commit hooks.

About

Terraform module to deploy AWS Batch Job.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages