Git Product home page Git Product logo

aws-ecs-task-service's Introduction

Terraform module to create AWS ECS service task .

terrafrom config example:

module "ecs_task_security_group" {
  source        = "git::https://github.com/mbelousov7/aws-security-group.git?ref=v1.0.0"
  vpc_id        = var.vpc_id
  ingress_rules = var.security_group.ingress_rules
  egress_rules  = var.security_group.egress_rules
  labels        = local.labels
}

module "ecs_task_definition" {
  source                      = "git::https://github.com/mbelousov7/aws-ecs-task-definition.git?ref=v1.0.0"
  aws_region                  = var.region
  container_name              = var.container_name
  container_image             = var.container_image
  task_cpu                    = var.task_cpu
  task_memory                 = var.task_memory
  task_role_policy_arns       = local.cloudteam_policy_arns
  task_role_policy_statements = var.task_role_policy_statements
  labels                      = local.labels
}


module "ecs_task_service" {
  source                  = "../.."
  task_definition_arn     = module.ecs_task_definition.task_definition_arn
  task_subnet_ids         = var.subnet_ids
  task_security_group_ids = [module.ecs_task_security_group.id]
  labels                  = local.labels
}

more info see examples/test

terraform run example

cd examples/test
terraform init
terraform plan

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

No modules.

Resources

Name Type
aws_cloudwatch_event_rule.task_stopped_rule resource
aws_cloudwatch_log_metric_filter.errors resource
aws_cloudwatch_metric_alarm.cpu_utilization resource
aws_cloudwatch_metric_alarm.default resource
aws_cloudwatch_metric_alarm.memory_utilization resource
aws_cloudwatch_metric_alarm.task_count resource
aws_ecs_cluster.ecs_cluster resource
aws_ecs_service.ecs_service resource

Inputs

Name Description Type Default Required
alarm_config add custom string into alarm descritptioon string "" no
alarm_enable n/a bool true no
alarm_log_configs The cloudwatch metrics filters definitions map
{
"logs-errors": {
"alarm_comparison_operator": "GreaterThanThreshold",
"alarm_description": "Erros in log files",
"alarm_evaluation_periods": 1,
"alarm_name": "log-errors",
"alarm_period": 60,
"alarm_statistic": "Sum",
"alarm_threshold": 0,
"alarm_treat_missing_data": "notBreaching",
"filter_pattern": ""ERROR"",
"metric_default_value": "0",
"metric_name": "ECSLogErrors",
"metric_value": "1"
}
}
no
alarm_topic_arn n/a string "" no
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
aws_ecs_cluster_containerInsights option to enabled | disabled CloudWatch Container Insights for a cluster string "enabled" no
cpu_utilization_threshold The maximum percentage of CPU utilization. number 80 no
deployment_maximum_percent n/a number 200 no
deployment_minimum_healthy_percent n/a number 100 no
ecs_cluster_arn provide value if ecs_cluster_new == false string "" no
ecs_cluster_name optionally define a custom value for the ecs cluster name and tag=Name parameter
in aws_ecs_cluster. By default, it is defined as a construction from var.labels
string "" no
ecs_cluster_new optionally set to false, then no new ecs cluster will be created bool true no
ecs_load_balancers A list of load balancer config objects for the ECS service; see ecs_service#load_balancer docs any [] no
ecs_service_name optionally define a custom value for the aws_ecs_service.
By default, it is defined as a construction from var.labels
string "" no
labels Minimum required map of labels(tags) for creating aws resources
object({
prefix = string
stack = string
component = string
env = string
})
n/a yes
launch_type The launch type on which to run your service. Valid values are EC2 and FARGATE string "FARGATE" no
memory_utilization_threshold The maximum percentage of Memory utilization. number 80 no
region n/a string "us-east-1" no
service_registries Zero or one service discovery registries for the service.
The currently supported service registry is Amazon Route 53 Auto Naming Service - aws_service_discovery_service;
see service_registries docs https://www.terraform.io/docs/providers/aws/r/ecs_service.html#service_registries-1"
Service registry is object with required key registry_arn = string and optional keys
port = number
container_name = string
container_port = number
list(any) [] no
tags Additional tags map(string) {} no
task_count_threshold The minimum task count threshold number 1 no
task_definition_arn Task definition arn string n/a yes
task_desired_count Number of instances of the task definition to place and keep running. number 1 no
task_security_group_ids Security group IDs to allow in Service network_configuration list(string) [] no
task_stopped_rule option to create aws_cloudwatch_event_rule which Trigger when the Fargate task has stopped bool false no
task_subnet_ids Subnet IDs used in Service network_configuration list(string) null no
wait_for_steady_state Terraform will wait for the service to reach a steady state (like aws ecs wait services-stable) before continuing bool true no

Outputs

Name Description
aws_ecs_cluster_arn ecs cluster arn
aws_ecs_cluster_name ecs cluster name
task_stopped_event_rule_name service task stopped event rule name

aws-ecs-task-service's People

Contributors

mbelousov7 avatar

Watchers

 avatar

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.