Skip to content

fivexl/terraform-aws-ecs-events-to-slack

Repository files navigation

FivexL

terraform-aws-ecs-events-to-slack

Rules for Amazon EventBridge that fetch ECS events and send them to Slack

Example

module "ecs_to_slack" {
  source            = "git::https://github.com/fivexl/terraform-aws-ecs-events-to-slack.git"
  name              = "ecs-to-slack"
  slack_webhook_url = "https://hooks.slack.com/YOUR-WEBHOOK-ID"
}

You can find more examples in the examples/ directory

Info

AWS Terraform provier versions

  • version 0.1.2 is the last version that works with both Terraform AWS provider v3 and v4. There are no plans to update 0.1.X branch.
  • all versions later (0.2.0 and above) require Terraform AWS provider v4 as a baseline

Requirements

Name Version
terraform >= 0.13.1
aws >= 3.69

Providers

Name Version
aws >= 3.69

Modules

Name Source Version
slack_notifications terraform-aws-modules/lambda/aws 5.0.0

Resources

Name Type
aws_cloudwatch_event_rule.this resource
aws_cloudwatch_event_target.this resource
aws_caller_identity.current data source
aws_region.current data source

Inputs

Name Description Type Default Required
cloudwatch_logs_retention_in_days Specifies the number of days you want to retain log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653. number 14 no
custom_event_rules A map of objects representing the custom EventBridge rule which will be created in addition to the default rules. any {} no
ecs_deployment_state_event_rule_detail The content of the detail section in the EvenBridge Rule for ECS Deployment State Change events. Use it to filter the events which will be processed and sent to Slack. any
{
"eventType": [
"ERROR"
]
}
no
ecs_service_action_event_rule_detail The content of the detail section in the EvenBridge Rule for ECS Service Action events. Use it to filter the events which will be processed and sent to Slack. any
{
"eventType": [
"WARN",
"ERROR"
]
}
no
ecs_task_state_event_rule_detail The content of the detail section in the EvenBridge Rule for ECS Task State Change events. Use it to filter the events which will be processed and sent to Slack. any
{
"lastStatus": [
"STOPPED"
],
"stoppedReason": [
{
"anything-but": {
"prefix": "Scaling activity initiated by (deployment ecs-svc/"
}
}
]
}
no
enable_ecs_deployment_state_event_rule The boolean flag enabling the EvenBridge Rule for ECS Deployment State Change events. The detail section of this rule is configured with ecs_deployment_state_event_rule_detail variable. bool true no
enable_ecs_service_action_event_rule The boolean flag enabling the EvenBridge Rule for ECS Service Action events. The detail section of this rule is configured with ecs_service_action_event_rule_detail variable. bool true no
enable_ecs_task_state_event_rule The boolean flag enabling the EvenBridge Rule for ECS Task State Change events. The detail section of this rule is configured with ecs_task_state_event_rule_detail variable. bool true no
lambda_memory_size Amount of memory in MB your Lambda Function can use at runtime. Valid value between 128 MB to 10,240 MB (10 GB), in 64 MB increments. number 256 no
name The string which will be used for the name of AWS Lambda function and other creaated resources string n/a yes
recreate_missing_package Whether to recreate missing Lambda package if it is missing locally or not. bool true no
role_name The string which will be used for the name of Lambda IAM role string null no
slack_webhook_url (default) A Slack incoming webhook URL. (if slack_webhook_url_source_type is 'secret') A secretsmanager secret name. string n/a yes
slack_webhook_url_source_type Define where to get the slack webhook URL for variable slack_webhook_url. Either as text input or from an AWS secretsmanager lookup string "text" no
tags A map of tags to add to all resources map(string) {} no

Outputs

No outputs.