Skip to content

stroeer/search-terraform-aws-ecs-scheduled-task

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-ecs-scheduled-task

Terraform module which creates ECS Scheduled Task resources on AWS.

Description

Provision ECS Task Definitions and CloudWatch Events.

This module provides recommended settings:

  • Fargate launch type
  • Disable assign public ip address

Usage

Minimal

module "ecs_scheduled_task" {
  source                = "git::https://github.com/stroeer/search-terraform-aws-ecs-scheduled-task.git?ref=tags/2.1.0"
  name                  = "example"
  schedule_expression   = "rate(3 minutes)"
  container_definitions = var.container_definitions
  cluster_arn           = var.cluster_arn
  subnets               = var.subnets
}

Complete

module "ecs_scheduled_task" {
  source                = "git::https://github.com/stroeer/search-terraform-aws-ecs-scheduled-task.git?ref=tags/2.1.0"
  name                  = "example"
  schedule_expression   = "rate(3 minutes)"
  container_definitions = var.container_definitions
  cluster_arn           = var.cluster_arn
  subnets               = var.subnets

  is_enabled               = true
  task_count               = 1
  platform_version         = "LATEST"
  assign_public_ip         = true
  security_groups          = []
  cpu                      = 256
  memory                   = 512
  requires_compatibilities = ["FARGATE"]
  iam_path                 = "/service_role/"
  description              = "This is example"
  enabled                  = true

  runtime_platform {
    operating_system_family = "LINUX"
    cpu_architecture        = "ARM64"
  }

  create_ecs_events_role = false
  ecs_events_role_arn    = var.ecs_events_role_arn

  create_ecs_task_execution_role = false
  ecs_task_execution_role_arn    = var.ecs_events_role_arn

  ecs_task_role_arn = var.ecs_task_role_arn

  tags = {
    Environment = "prod"
  }
}

Examples

Requirements

Name Version
terraform >= 0.12

Providers

Name Version
aws n/a

Inputs

Name Description Type Default Required
cluster_arn ARN of an ECS cluster. string n/a yes
container_definitions A list of valid container definitions provided as a single valid JSON document. string n/a yes
name The name of ecs task definition. string n/a yes
schedule_expression The scheduling expression.For example, cron(0 20 * * ? *) or rate(5 minutes). string n/a yes
subnets The subnets associated with the task or service. list(string) n/a yes
assign_public_ip Assign a public IP address to the ENI (Fargate launch type only). string false no
cpu The number of cpu units used by the task. string "256" no
create_ecs_events_role Specify true to indicate that CloudWatch Events IAM Role creation. string true no
create_ecs_task_execution_role Specify true to indicate that ECS Task Execution IAM Role creation. string true no
description The description of the all resources. string "Managed by Terraform" no
ecs_events_role_arn The ARN of the CloudWatch Events IAM Role. string "" no
ecs_task_execution_role_arn The ARN of the ECS Task Execution IAM Role. string "" no
ecs_task_role_arn The ARN of the ECS Tasks own IAM Role. string "" no
enabled Set to false to prevent the module from creating anything. bool true no
iam_path Path in which to create the IAM Role and the IAM Policy. string "/" no
is_enabled Whether the rule should be enabled. string true no
memory The amount (in MiB) of memory used by the task. string "512" no
platform_version Specifies the platform version for the task. string "1.4.0" no
requires_compatibilities A set of launch types required by the task. The valid values are EC2 and FARGATE. list(string)
[
"FARGATE"
]
no
security_groups The security groups associated with the task or service. list(string) [] no
runtime_platform Information about the platform for the Amazon ECS service or task. map(string) {} no

| tags | A mapping of tags to assign to all resources. | map(string) | {} | no | | task_count | The number of tasks to create based on the TaskDefinition. | string | 1 | no |

Outputs

Name Description
cloudwatch_event_rule_arn The Amazon Resource Name (ARN) of the rule.
ecs_events_policy_arn The ARN assigned by AWS to this CloudWatch Events IAM Policy.
ecs_events_policy_description The description of the CloudWatch Events IAM Policy.
ecs_events_policy_document The policy document of the CloudWatch Events IAM Policy.
ecs_events_policy_id The CloudWatch Events IAM Policy's ID.
ecs_events_policy_name The name of the CloudWatch Events IAM Policy.
ecs_events_policy_path The path of the CloudWatch Events IAM Policy.
ecs_events_role_arn The Amazon Resource Name (ARN) specifying the CloudWatch Events IAM Role.
ecs_events_role_create_date The creation date of the IAM Role.
ecs_events_role_description The description of the CloudWatch Events IAM Role.
ecs_events_role_name The name of the CloudWatch Events IAM Role.
ecs_events_role_unique_id The stable and unique string identifying the CloudWatch Events IAM Role.
ecs_task_definition_arn Full ARN of the Task Definition (including both family and revision).
ecs_task_definition_family The family of the Task Definition.
ecs_task_definition_revision The revision of the task in a particular family.
ecs_task_execution_policy_arn The ARN assigned by AWS to this ECS Task Execution IAM Policy.
ecs_task_execution_policy_description The description of the ECS Task Execution IAM Policy.
ecs_task_execution_policy_document The policy document of the ECS Task Execution IAM Policy.
ecs_task_execution_policy_id The ECS Task Execution IAM Policy's ID.
ecs_task_execution_policy_name The name of the ECS Task Execution IAM Policy.
ecs_task_execution_policy_path The path of the ECS Task Execution IAM Policy.
ecs_task_execution_role_arn The Amazon Resource Name (ARN) specifying the ECS Task Execution IAM Role.
ecs_task_execution_role_create_date The creation date of the ECS Task Execution IAM Role.
ecs_task_execution_role_description The description of the ECS Task Execution IAM Role.
ecs_task_execution_role_name The name of the ECS Task Execution IAM Role.
ecs_task_execution_role_unique_id The stable and unique string identifying the ECS Task Execution IAM Role.

License

Apache 2 Licensed. See LICENSE for full details.

About

Terraform module which creates ECS Scheduled Task resources on AWS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 100.0%