GithubHelp home page GithubHelp logo

baikonur-oss / terraform-aws-fargate-scheduled-task Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 3.0 37 KB

AWS Fargate Scheduled Task Terraform Module

License: MIT License

HCL 100.00%
aws-fargate terraform-module

terraform-aws-fargate-scheduled-task's Introduction

AWS Fargate Scheduled Task Terraform Module

Terraform module for scheduling Fargate tasks with CloudWatch Event Rules.

terraform v0.12.x

Usage

module "fargate-scheduled-task" {
  source  = "baikonur-oss/fargate-scheduled-task/aws"
  version = "v2.0.2"

  name                = "dev-batch-foo"
  schedule_expression = "cron(40 1 * * ? *)"
  is_enabled          = "true"

  target_cluster_arn = "dev"

  task_definition_arn = aws_ecs_task_definition.ecs_task_definition.arn
  task_role_arn       = module.iam_ecs_tasks.arn
  task_count          = "1"

  subnet_ids         = ["subnet-***1", "subnet-***2"]
  security_group_ids = ["sg-***1", "sg-***2"]
}

module "iam_ecs_tasks" {
  source  = "baikonur-oss/iam-nofile/aws"
  version = "2.0.0"
  type    = "ecs-tasks"
  name    = "dev-batch"

  policy_json = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogStream",
        "logs:PutLogEvents"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:*"
      ],
      "Resource": [
        "arn:aws:s3:::example-bucket/*"
      ]
    }
  ]
}
EOF
}

Version pinning

Terraform Module Registry

Use version parameter to pin to a specific version, or to specify a version constraint when pulling from Terraform Module Registry (source = baikonur-oss/aws-fargate-scheduled-task/aws). For more information, refer to Module Versions section of Terraform Modules documentation.

GitHub URI

Make sure to use ?ref= version pinning in module source URI when pulling from GitHub. Pulling from GitHub is especially useful for development, as you can pin to a specific branch, tag or commit hash. Example: source = github.com/baikonur-oss/terraform-aws-fargate-scheduled-task?ref=v1.0.0

For more information on module version pinning, see Selecting a Revision section of Terraform Modules documentation.

Inputs

Name Description Type Default Required
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 n/a yes
iam_ecs_run_task_resource Field for overriding ecs:RunTask resource identifier in Events IAM role (defaults to task_definition_arn) string "" no
is_enabled Rule enabled flag string "true" no
name CloudWatch Event Rule name string n/a yes
schedule_expression CloudWatch schedule expression (see: https://docs.aws.amazon.com/ja_jp/AmazonCloudWatch/latest/events/ScheduledEvents.html ) string n/a yes
security_group_ids List of security group ids for Fargate task ENI list(string) n/a yes
subnet_ids List of subnet ids for Fargate task ENI list(string) n/a yes
assign_public_ip Assign public ip for Fargate task ENI string "false" no
target_cluster_arn Target ECS cluster ARN string n/a yes
task_count Number of tasks to execute at once string "1" no
task_definition_arn ARN of Task Definition to run string n/a yes
task_role_arn ARN of IAM Role for task (see: https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/task-iam-roles.html ) string n/a yes
platform_version Platform version string "1.4.0" no

Contributing

Make sure to have following tools installed:

macOS

brew install pre-commit terraform terraform-docs

# set up pre-commit hooks by running below command in repository root
pre-commit install

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.