generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: publish Glue job failures to SNS #24
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update Glue job failures event triggers to publish directly to SNS using the CloudWatch alarm message payload structure. This allows us to publish to the existing SRE Bot webhook.
Production: alarms 🚨✅ Terraform Init: Plan: 1 to add, 0 to change, 1 to destroy Show summary
Show planResource actions are indicated with the following symbols:
+ create
- destroy
Terraform will perform the following actions:
# aws_cloudwatch_event_target.glue_job_failure will be created
+ resource "aws_cloudwatch_event_target" "glue_job_failure" {
+ arn = "arn:aws:sns:ca-central-1:739275439843:cloudwatch-alarm-action"
+ event_bus_name = "default"
+ force_destroy = false
+ id = (known after apply)
+ rule = "glue-job-failures"
+ target_id = "send-to-sns"
+ input_transformer {
+ input_paths = {
+ "jobName" = "$.detail.jobName"
+ "message" = "$.detail.message"
+ "state" = "$.detail.state"
}
+ input_template = jsonencode(
{
+ Message = jsonencode(
{
+ AWSAccountId = "739275439843"
+ AlarmArn = "arn:aws:cloudwatch:ca-central-1:739275439843:alarm:glue-job-failure"
+ AlarmDescription = "`<state>` detected for Glue job `<jobName>`"
+ AlarmName = "glue-job-failure"
+ NewStateReason = "<message>"
+ NewStateValue = "ALARM"
+ OldStateValue = "OK"
}
)
}
)
}
}
# aws_cloudwatch_metric_alarm.glue_job_failures will be destroyed
# (because aws_cloudwatch_metric_alarm.glue_job_failures is not in configuration)
- resource "aws_cloudwatch_metric_alarm" "glue_job_failures" {
- actions_enabled = true -> null
- alarm_actions = [
- "arn:aws:sns:ca-central-1:739275439843:cloudwatch-alarm-action",
] -> null
- alarm_description = "Failed Glue jobs in a 1 minute period." -> null
- alarm_name = "glue-job-failures" -> null
- arn = "arn:aws:cloudwatch:ca-central-1:739275439843:alarm:glue-job-failures" -> null
- comparison_operator = "GreaterThanThreshold" -> null
- datapoints_to_alarm = 0 -> null
- dimensions = {
- "JobName" = "*"
} -> null
- evaluation_periods = 1 -> null
- id = "glue-job-failures" -> null
- metric_name = "glue-job-failure" -> null
- namespace = "data-lake" -> null
- ok_actions = [
- "arn:aws:sns:ca-central-1:739275439843:cloudwatch-ok-action",
] -> null
- period = 60 -> null
- statistic = "Sum" -> null
- tags_all = {
- "CostCentre" = "PlatformDataLake"
- "Terraform" = "true"
} -> null
- threshold = 0 -> null
- treat_missing_data = "notBreaching" -> null
# (4 unchanged attributes hidden)
}
Plan: 1 to add, 0 to change, 1 to destroy.
─────────────────────────────────────────────────────────────────────────────
Saved the plan to: plan.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "plan.tfplan"
Show Conftest resultsWARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.glue_job_failure"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.glue_crawler_error"]
WARN - plan.json - main - Missing Common Tags: ["aws_kms_key.cloudwatch"]
WARN - plan.json - main - Missing Common Tags: ["aws_sns_topic.cloudwatch_alarm_action"]
WARN - plan.json - main - Missing Common Tags: ["aws_sns_topic.cloudwatch_ok_action"]
24 tests, 19 passed, 5 warnings, 0 failures, 0 exceptions
|
wmoussa-gc
approved these changes
Nov 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Update Glue job failure event triggers to publish directly to SNS using the CloudWatch alarm message payload structure. This allows us to publish to the existing SRE Bot webhook without the need for a custom Lambda.
Related