Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

umotif-public/terraform-aws-ecs-fargate-scheduled-task

Repository files navigation

GitHub release (latest SemVer)

terraform-aws-ecs-fargate-scheduled-task

Terraform module to create AWS ECS Fargate Scheduled Task

Terraform versions

Terraform 0.12. Pin module version to ~> v1.0. Submit pull-requests to master branch.

Usage

module "ecs-fargate-scheduled-task" {
  source = "umotif-public/ecs-fargate-scheduled-task/aws"
  version = "~> 1.0.0"

  name_prefix = "test-scheduled-task"

  ecs_cluster_arn = aws_ecs_cluster.main.arn

  task_role_arn      = var.task_role_arn
  execution_role_arn = var.execution_role_arn

  event_target_task_definition_arn = var.event_target_task_definition_arn
  event_rule_schedule_expression   = "rate(1 minute)"
  event_target_subnets             = ["subnet-1","subnet-2"]
}

Assumptions

Module is to be used with Terraform > 0.12.

Examples

Authors

Module managed by Marcin Cuber LinkedIn.

Requirements

Name Version
terraform >= 0.12.6
aws >= 2.45

Providers

Name Version
aws >= 2.45

Inputs

Name Description Type Default Required
ecs_cluster_arn The ECS Cluster where the scheduled task will be running any n/a yes
event_rule_description The description of the rule. any null no
event_rule_event_pattern (Required, if schedule_expression isn't specified) Event pattern described a JSON object. See full documentation of CloudWatch Events and Event Patterns for details. any null no
event_rule_is_enabled Whether the rule should be enabled. bool true no
event_rule_name The rule's name. string "" no
event_rule_role_arn The Amazon Resource Name (ARN) associated with the role that is used for target invocation. any null no
event_rule_schedule_expression (Required, if event_pattern isn't specified) The scheduling expression. For example, cron(0 20 * * ? *) or rate(5 minutes). any null no
event_target_assign_public_ip Assign a public IP address to the ENI (Fargate launch type only). Valid values are true or false. Default false. bool false no
event_target_group Specifies an ECS task group for the task. The maximum length is 255 characters. any null no
event_target_id The unique target assignment ID. If missing, will generate a random, unique id. any null no
event_target_input Valid JSON text passed to the target. any null no
event_target_input_path The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. any null no
event_target_platform_version Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as 1.1.0. This is used only if LaunchType is FARGATE. For more information about valid platform versions, see AWS Fargate Platform Versions. Default to LATEST string "LATEST" no
event_target_security_groups The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. list [] no
event_target_subnets The subnets associated with the task or service. list n/a yes
event_target_task_count The number of tasks to create based on the TaskDefinition. The default is 1. number 1 no
event_target_task_definition_arn The ARN of the task definition to use if the event target is an Amazon ECS cluster. any n/a yes
execution_role_arn ARN of IAM Role for task execution (see: https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/task_execution_IAM_role.html ) string "" no
name_prefix Name prefix for resources on AWS. any n/a yes
tags A map of tags (key-value pairs) passed to resources. map(string) {} no
task_role_arn ARN of IAM Role for task (see: https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/task-iam-roles.html ) any n/a yes

Outputs

Name Description
aws_cloudwatch_event_rule_event_rule_arn The Amazon Resource Name (ARN) of the CloudWatch Event Rule.
aws_iam_role_policy_id The role policy ID, in the form of role_name:role_policy_name.
aws_iam_role_policy_name The name of the policy.
aws_iam_role_policy_role The name of the role associated with the policy.
event_role_arn The Amazon Resource Name (ARN) specifying the role.
event_role_create_date The creation date of the IAM role.
event_role_description The description of the role.
event_role_id The name of the role.
event_role_name The name of the role.
event_role_unique_id The stable and unique string identifying the role.

License

See LICENSE for full details.

Pre-commit hooks

Install dependencies

MacOS

brew install pre-commit terraform-docs tflint

brew tap git-chglog/git-chglog
brew install git-chglog