-
Notifications
You must be signed in to change notification settings - Fork 6
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
SMS (SNS) stored queries from CWI into Terraform / SMS (pinpoint) new queries #1574
Conversation
QUERY | ||
} | ||
|
||
resource "aws_cloudwatch_query_definition" "pinpoint-failures-by-carrier" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new query over here for failures by carrier.
@@ -1,6 +1,41 @@ | |||
resource "aws_cloudwatch_query_definition" "pinpoint-carrier-dwell-times" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the equivalent of sms-carrier-dwell-times
but for pinpoint.
query_string = <<QUERY | ||
stats avg(delivery.dwellTimeMsUntilDeviceAck / 1000 / 60) as Avg_carrier_time_minutes, | ||
| count(*) as Number by delivery.phoneCarrier as Carrier | ||
QUERY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The count(*) as Number
should be on a new line for better readability and consistency with other queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is on a new line.
fields @timestamp as Timestamp, status as Status, notification.messageId as `Message ID`, | ||
delivery.destination as `Destination phone number`, delivery.providerResponse as `Provider response`, | ||
delivery.smsType as `Message type` | ||
| filter delivery.destination like '1416xxxxxxx' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider parameterizing the phone number filter to avoid hardcoding '1416xxxxxxx'. This will make the query more flexible and reusable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can use parameters in these unfortunately. If that was a query in a dashboard, yeah but that is not the case.
aws/common/cloudwatch_queries.tf
Outdated
|
||
resource "aws_cloudwatch_query_definition" "sms-sns-unreachable-phone-numbers" { | ||
count = var.cloudwatch_enabled ? 1 : 0 | ||
name = "SMS (SNS) / Success vs Unreachable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name 'SMS (SNS) / Success vs Unreachable' is duplicated from the previous query definition. Consider renaming this to avoid confusion.
@@ -149,6 +149,195 @@ resource "aws_cloudwatch_metric_alarm" "total-sms-spending-critical" { | |||
} | |||
} | |||
|
|||
resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-bell-warning" { | |||
count = var.cloudwatch_enabled ? 1 : 0 | |||
alarm_name = "pinpoint-sms-failures-telus-warning" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alarm_name
for this resource is pinpoint-sms-failures-telus-warning
, but the description and dimensions indicate it is for Bell Cellular Inc. / Aliant Telecom. Consider renaming the alarm_name
to accurately reflect the carrier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really need the AI with my clumsiness.
|
||
resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-bragg-warning" { | ||
count = var.cloudwatch_enabled ? 1 : 0 | ||
alarm_name = "pinpoint-sms-failures-telus-warning" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alarm_name
for this resource is pinpoint-sms-failures-telus-warning
, but the description and dimensions indicate it is for BRAGG Communications INC. Consider renaming the alarm_name
to accurately reflect the carrier.
@@ -11,6 +12,7 @@ | |||
} | |||
|
|||
resource "aws_cloudwatch_log_group" "pinpoint_deliveries_failures" { | |||
# REVIEW: We might want the count attribute present to disable this resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment suggests adding a count
attribute to conditionally create the resource. If this is a valid requirement, consider implementing it directly in the code rather than leaving a comment.
QUERY | ||
} | ||
|
||
resource "aws_cloudwatch_query_definition" "pintpoint-sms-get-failures" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the resource name. It should be pinpoint
instead of pintpoint
.
originationPhoneNumber as `Origination phone number`, destinationPhoneNumber as `Destination phone number`, | ||
messageId as `Message ID`, messageStatus as `Message Status`, | ||
messageStatusDescription as `Message status description`, @message | ||
| parse messageStatusDescription "Phone is currently unreachable/*" as @unavailable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parse
statements should be reviewed to ensure they correctly match the intended patterns. Consider testing these patterns to confirm they work as expected.
@@ -3,6 +3,7 @@ | |||
# | |||
|
|||
resource "aws_cloudwatch_log_group" "pinpoint_deliveries" { | |||
# REVIEW: We might want the count attribute present to disable this resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah probably a good idea to have it enabled/disabled based on cloudwatch enabled.
@@ -11,6 +12,7 @@ resource "aws_cloudwatch_log_group" "pinpoint_deliveries" { | |||
} | |||
|
|||
resource "aws_cloudwatch_log_group" "pinpoint_deliveries_failures" { | |||
# REVIEW: We might want the count attribute present to disable this resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
Updating alarms ⏰? Great! Please update the Google Sheet and add a 👍 to this message after 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but feel free to add the count line on those two log groups
@@ -11,6 +12,7 @@ resource "aws_cloudwatch_log_group" "pinpoint_deliveries" { | |||
} | |||
|
|||
resource "aws_cloudwatch_log_group" "pinpoint_deliveries_failures" { | |||
# REVIEW: We might want the count attribute present to disable this resource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
staging: common✅ Terraform Init: Plan: 11 to add, 0 to change, 4 to destroy Show summary
Show planResource actions are indicated with the following symbols:
+ create
-/+ destroy and then create replacement
Terraform will perform the following actions:
# aws_cloudwatch_query_definition.sms-sns-blocked-as-spam[0] will be created
+ resource "aws_cloudwatch_query_definition" "sms-sns-blocked-as-spam" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
]
+ name = "SMS (SNS) / Block as spam"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, delivery.phoneCarrier as Carrier, delivery.providerResponse as `Provider response`, delivery.destination as `Destination phone number`
| filter delivery.providerResponse like 'spam'
| sort Timestamp desc
| limit 100
}
EOT
}
# aws_cloudwatch_query_definition.sms-sns-carrier-dwell-times[0] will be created
+ resource "aws_cloudwatch_query_definition" "sms-sns-carrier-dwell-times" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (SNS) / Carrier dwell times"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
stats avg(delivery.dwellTimeMsUntilDeviceAck / 1000 / 60) as Avg_carrier_time_minutes,
| count(*) as Number by delivery.phoneCarrier as Carrier
EOT
}
# aws_cloudwatch_query_definition.sms-sns-get-failures[0] will be created
+ resource "aws_cloudwatch_query_definition" "sms-sns-get-failures" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
]
+ name = "SMS (SNS) / Get failures"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, status, delivery.phoneCarrier as Carrier, delivery.providerResponse as `Provider response`, delivery.destination as `Destination phone number`, notification.messageId as messageId, @message
| filter status = 'FAILURE'
| sort Timestamp desc
| limit 200
EOT
}
# aws_cloudwatch_query_definition.sms-sns-get-sms-logs-by-phone-number[0] will be created
+ resource "aws_cloudwatch_query_definition" "sms-sns-get-sms-logs-by-phone-number" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (SNS) / Get SMS logs by phone number"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, status as Status, notification.messageId as `Message ID`,
delivery.destination as `Destination phone number`, delivery.providerResponse as `Provider response`,
delivery.smsType as `Message type`
| filter delivery.destination like '1416xxxxxxx'
| sort Timestamp desc
| limit 100
EOT
}
# aws_cloudwatch_query_definition.sms-sns-international-sending-status[0] will be created
+ resource "aws_cloudwatch_query_definition" "sms-sns-international-sending-status" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (SNS) / International sending status"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp, @message, delivery.mcc as CountryCode, status
| stats count(*) as Event_Count by CountryCode, status
| display CountryCode, status, Event_Count
| sort CountryCode asc
| limit 200
EOT
}
# aws_cloudwatch_query_definition.sms-sns-success-vs-unreachable[0] will be created
+ resource "aws_cloudwatch_query_definition" "sms-sns-success-vs-unreachable" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (SNS) / Success vs Unreachable"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp, delivery.providerResponse
| parse delivery.providerResponse "Phone is currently unreachable/*" as @unavailable
| parse delivery.providerResponse "Message has been * by phone" as @available
| sort @timestamp desc
| stats count(@unavailable), count(@available), count(*) by bin(1h)
EOT
}
# aws_cloudwatch_query_definition.sms-sns-unreachable-phone-numbers[0] will be created
+ resource "aws_cloudwatch_query_definition" "sms-sns-unreachable-phone-numbers" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
]
+ name = "SMS (SNS) / Unreachable phone numbers"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp, delivery.providerResponse
| filter delivery.providerResponse like "Phone is currently unreachable/unavailable"
| sort @timestamp desc
| limit 20
EOT
}
# module.notify_slack_critical.module.lambda.null_resource.archive[0] must be replaced
-/+ resource "null_resource" "archive" {
~ id = "3122383301478814050" -> (known after apply)
~ triggers = { # forces replacement
~ "timestamp" = "1728996723902029000" -> "1729012320733147000"
# (1 unchanged element hidden)
}
}
# module.notify_slack_general.module.lambda.null_resource.archive[0] must be replaced
-/+ resource "null_resource" "archive" {
~ id = "2216587944148775990" -> (known after apply)
~ triggers = { # forces replacement
~ "timestamp" = "1728996714859508000" -> "1729012313516547000"
# (1 unchanged element hidden)
}
}
# module.notify_slack_ok.module.lambda.null_resource.archive[0] must be replaced
-/+ resource "null_resource" "archive" {
~ id = "1622777836158567318" -> (known after apply)
~ triggers = { # forces replacement
~ "timestamp" = "1728996723861883000" -> "1729012320751702000"
# (1 unchanged element hidden)
}
}
# module.notify_slack_warning.module.lambda.null_resource.archive[0] must be replaced
-/+ resource "null_resource" "archive" {
~ id = "511035389387176401" -> (known after apply)
~ triggers = { # forces replacement
~ "timestamp" = "1728996723847986000" -> "1729012320744919000"
# (1 unchanged element hidden)
}
}
Plan: 11 to add, 0 to change, 4 to destroy.
Warning: Argument is deprecated
with aws_s3_bucket.csv_bucket,
on s3.tf line 5, in resource "aws_s3_bucket" "csv_bucket":
5: resource "aws_s3_bucket" "csv_bucket" {
Use the aws_s3_bucket_server_side_encryption_configuration resource instead
(and 65 more similar warnings elsewhere)
─────────────────────────────────────────────────────────────────────────────
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_athena_workgroup.ad_hoc"]
WARN - plan.json - main - Missing Common Tags: ["aws_athena_workgroup.build_tables"]
WARN - plan.json - main - Missing Common Tags: ["aws_athena_workgroup.primary"]
WARN - plan.json - main - Missing Common Tags: ["aws_athena_workgroup.support"]
WARN - plan.json - main - Missing Common Tags: ["aws_budgets_budget.notify_global"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_event_rule.aws_health[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.route53_resolver_query_log[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.sns_deliveries[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.sns_deliveries_failures[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.sns_deliveries_failures_us_west_2[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.sns_deliveries_us_west_2[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.bulk-bulk-not-being-processed-critical[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.bulk-bulk-not-being-processed-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.bulk-inflights-not-being-processed-critical[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.bulk-inflights-not-being-processed-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.bulk-not-being-processed-critical[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.bulk-not-being-processed-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.contact-3-500-error-15-minutes-critical[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.document-download-bucket-size-warning[0]"]
WARN - plan.json... |
staging: pinpoint_to_sqs_sms_callbacks✅ Terraform Init: Plan: 19 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_log_group.pinpoint_deliveries has moved to aws_cloudwatch_log_group.pinpoint_deliveries[0]
resource "aws_cloudwatch_log_group" "pinpoint_deliveries" {
id = "sns/ca-central-1/239043911459/PinpointDirectPublishToPhoneNumber"
name = (sensitive value)
tags = {
"CostCenter" = "notification-canada-ca-staging"
}
# (7 unchanged attributes hidden)
}
# aws_cloudwatch_log_group.pinpoint_deliveries_failures has moved to aws_cloudwatch_log_group.pinpoint_deliveries_failures[0]
resource "aws_cloudwatch_log_group" "pinpoint_deliveries_failures" {
id = "sns/ca-central-1/239043911459/PinpointDirectPublishToPhoneNumber/Failure"
name = (sensitive value)
tags = {
"CostCenter" = "notification-canada-ca-staging"
}
# (7 unchanged attributes hidden)
}
# aws_cloudwatch_log_metric_filter.pinpoint-sms-failures-carriers[0] will be created
+ resource "aws_cloudwatch_log_metric_filter" "pinpoint-sms-failures-carriers" {
+ id = (known after apply)
+ log_group_name = (sensitive value)
+ name = "pinpoint-sms-failures-carriers"
+ pattern = "{ ($.isFinal IS TRUE) && ($.carrierName != \"\" && ( ($.messageStatus != \"SUCCESSFUL\") && ($.messageStatus != \"DELIVERED\") )) }"
+ metric_transformation {
+ dimensions = {
+ "Carrier" = "$.carrierName"
}
+ name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ unit = "None"
+ value = "1"
}
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-bell-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-bell-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for Bell Cellular Inc. / Aliant Telecom."
+ alarm_name = "pinpoint-sms-failures-bell-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "Bell Cellular Inc. / Aliant Telecom"
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-bragg-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-bragg-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for BRAGG Communications INC."
+ alarm_name = "pinpoint-sms-failures-bragg-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "BRAGG Communications INC."
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-freedom-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-freedom-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for Freedom Mobile Inc."
+ alarm_name = "pinpoint-sms-failures-freedom-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "Freedom Mobile Inc."
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-iristel-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-iristel-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for Iristel Inc."
+ alarm_name = "pinpoint-sms-failures-iristel-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "Iristel Inc."
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-maritime-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-maritime-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for Maritime Telephone & Telegraph Ltd."
+ alarm_name = "pinpoint-sms-failures-maritime-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "Maritime Telephone & Telegraph Ltd"
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-mts-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-mts-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for MTS Communications Inc."
+ alarm_name = "pinpoint-sms-failures-mts-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "MTS Communications Inc."
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-rogers-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-rogers-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for Rogers Communications Canada Inc."
+ alarm_name = "pinpoint-sms-failures-rogers-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "Rogers Communications Canada Inc."
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-telus-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-telus-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for Telus Communications"
+ alarm_name = "pinpoint-sms-failures-telus-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "Telus Communications"
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_metric_alarm.pinpoint-sms-failures-videotron-warning[0] will be created
+ resource "aws_cloudwatch_metric_alarm" "pinpoint-sms-failures-videotron-warning" {
+ actions_enabled = true
+ alarm_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ alarm_description = "Pinpoint SMS failures are more than 50 for Videotron Ltd."
+ alarm_name = "pinpoint-sms-failures-videotron-warning"
+ arn = (known after apply)
+ comparison_operator = "GreaterThanThreshold"
+ dimensions = {
+ "Carrier" = "Videotron Ltd."
}
+ evaluate_low_sample_count_percentiles = (known after apply)
+ evaluation_periods = 1
+ id = (known after apply)
+ metric_name = "pinpoint-sms-failures-carriers"
+ namespace = "LogMetrics"
+ ok_actions = [
+ "arn:aws:sns:ca-central-1:239043911459:alert-warning",
]
+ period = 300
+ statistic = "Sum"
+ tags_all = (known after apply)
+ threshold = 50
+ treat_missing_data = "notBreaching"
}
# aws_cloudwatch_query_definition.pinpoint-logs[0] will be destroyed
# (because aws_cloudwatch_query_definition.pinpoint-logs is not in configuration)
- resource "aws_cloudwatch_query_definition" "pinpoint-logs" {
- id = "3c055307-3799-4600-8521-98a558a484db" -> null
- log_group_names = [
- (sensitive value),
] -> null
- name = "SMS / Pinpoint logs" -> null
- query_definition_id = "3c055307-3799-4600-8521-98a558a484db" -> null
- query_string = <<-EOT
fields @timestamp, destinationPhoneNumber, messageStatus, messageStatusDescription, @logStream
| filter isFinal
| sort @timestamp desc
| limit 100
EOT -> null
}
# aws_cloudwatch_query_definition.pinpoint-sms-blocked-as-spam[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-blocked-as-spam" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Block as spam"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, carrierName as Carrier, messageStatus as `Provider response`,
originationPhoneNumber as `Origination phone number`, destinationPhoneNumber as `Destination phone number`,
messageId as `Message ID`, messageStatus as `Message Status`,
messageStatusDescription as `Message status description`, @message
| filter isFinal
| filter eventType = 'TEXT_SPAM'
| sort Timestamp desc
| limit 100
}
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-carrier-dwell-times[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-carrier-dwell-times" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Carrier dwell times"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
stats avg((eventTimestamp - messageRequestTimestamp) / 1000 / 60) as Avg_carrier_time_minutes,
count(*) as Number by carrierName as Carrier
| filter isFinal
| sort by Avg_carrier_time_minutes desc
| limit 100
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-failures-by-carrier[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-failures-by-carrier" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Failures by carrier"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
filter isFinal
| filter messageStatus not like /DELIVERED|SUCCESSFUL/
| stats count(*) as Total by coalesce(carrierName, 'Unknown/VOIP') as Carrier, messageStatus as MessageStatus
| sort by Total desc
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-get-failures[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-get-failures" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Get failures"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, carrierName as Carrier, messageStatus as `Provider response`,
originationPhoneNumber as `Origination phone number`, destinationPhoneNumber as `Destination phone number`,
messageId as `Message ID`, messageStatus as `Message Status`,
messageStatusDescription as `Message status description`, @message
| filter isFinal
| sort @timestamp desc
| limit 100
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-get-logs[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-get-logs" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Logs"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, carrierName as Carrier, messageStatus as `Provider response`,
originationPhoneNumber as `Origination phone number`, destinationPhoneNumber as `Destination phone number`,
messageId as `Message ID`, messageStatus as `Message Status`,
messageStatusDescription as `Message status description`, @message
| filter isFinal
| sort @timestamp desc
| limit 100
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-get-sms-logs-by-dest-phone-number[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-get-sms-logs-by-dest-phone-number" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Get SMS logs by destination phone number"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, carrierName as Carrier, messageStatus as `Provider response`,
originationPhoneNumber as `Origination phone number`, destinationPhoneNumber as `Destination phone number`,
messageId as `Message ID`, messageStatus as `Message Status`,
messageStatusDescription as `Message status description`, @message
| filter destinationPhoneNumber like '+1416xxxxxxx'
| sort Timestamp desc
| limit 100
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-get-sms-logs-by-orig-phone-number[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-get-sms-logs-by-orig-phone-number" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Get SMS logs by origination phone number"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, carrierName as Carrier, messageStatus as `Provider response`,
originationPhoneNumber as `Origination phone number`, destinationPhoneNumber as `Destination phone number`,
messageId as `Message ID`, messageStatus as `Message Status`,
messageStatusDescription as `Message status description`, @message
| filter originationPhoneNumber like '237762'
| sort Timestamp desc
| limit 100
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-international-sending-status[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-international-sending-status" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / International sending status"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp, @message
| parse @message /"isoCountryCode":"(?<Country>[^"]+)"/
| parse @message /"eventType":"(?<Event_Type>[^"]+)"/
| parse @message /"isFinal":(?<Is_Final>\w+)/
| filter Is_Final = "true"
| stats count(*) as Event_Count by Country, Event_Type
| display Country, Event_Type, Event_Count
| sort Country asc
| limit 100
EOT
}
# aws_cloudwatch_query_definition.pinpoint-sms-success-vs-unreachable[0] will be created
+ resource "aws_cloudwatch_query_definition" "pinpoint-sms-success-vs-unreachable" {
+ id = (known after apply)
+ log_group_names = [
+ (sensitive value),
+ (sensitive value),
]
+ name = "SMS (Pinpoint) / Success vs Unreachable"
+ query_definition_id = (known after apply)
+ query_string = <<-EOT
fields @timestamp as Timestamp, carrierName as Carrier, messageStatus as `Provider response`,
originationPhoneNumber as `Origination phone number`, destinationPhoneNumber as `Destination phone number`,
messageId as `Message ID`, messageStatus as `Message Status`,
messageStatusDescription as `Message status description`, @message
| parse messageStatusDescription "Phone is currently unreachable/*" as @unavailable
| parse messageStatusDescription "Message has been * by phone" as @available
| stats count(@unavailable) as Unavailable, count(@available) as Available, count(*) as Total by bin(1h)
EOT
}
Plan: 19 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_log_group.pinpoint_deliveries[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.pinpoint_deliveries_failures[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_log_group.pinpoint_to_sqs_sms_callbacks_log_group[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.lambda-image-pinpoint-delivery-receipts-errors-critical[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.lambda-image-pinpoint-delivery-receipts-errors-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.logs-1-500-error-1-minute-warning-pinpoint_to_sqs_sms_callbacks-api[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.logs-10-500-error-5-minutes-critical-pinpoint_to_sqs_sms_callbacks-api[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-blocked-as-spam-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-bell-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-bragg-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-freedom-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-iristel-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-maritime-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-mts-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-rogers-warning[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudwatch_metric_alarm.pinpoint-sms-failures-telus-warning[0]"]
WARN - plan.json - main -... |
staging: quicksight✅ Terraform Init: Plan: 0 to add, 1 to change, 0 to destroy Show summary
Show planResource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# aws_s3_object.manifest_file will be updated in-place
~ resource "aws_s3_object" "manifest_file" {
~ etag = "4f558e8d8cdbbf914a95755cbda61968" -> "221f592f333f2fc284626cfdb8c4bc80"
id = "quicksight/s3-manifest-sms-usage.json"
tags = {}
+ version_id = (known after apply)
# (24 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 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_cloudformation_stack.sms-usage-notifications"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.quicksight-rds"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.quicksight-s3-usage"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.quicksight_vpc_connection_ec2"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.quicksight_vpc_connection_iam"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_role.quicksight"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_role.vpc_connection_role"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.jobs"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.login_events"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.notifications"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.organisation"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.services"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.sms_usage"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.template-category-history"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.templates"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_set.users"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_source.rds"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_data_source.s3_sms_usage"]
WARN - plan.json - main - Missing Common Tags: ["aws_quicksight_vpc_connection.rds"]
WARN - plan.json - main - Missing Common Tags: ["aws_s3_object.manifest_file"]
39 tests, 19 passed, 20 warnings, 0 failures, 0 exceptions
|
Summary | Résumé
Related Issues | Cartes liées
Before merging this PR
Read code suggestions left by the
cds-ai-codereviewer bot. Address
valid suggestions and shortly write down reasons to not address others. To help
with the classification of the comments, please use these reactions on each of the
comments made by the AI review:
The classifications will be extracted and summarized into an analysis of how helpful
or not the AI code review really is.
Test instructions | Instructions pour tester la modification
Before the PR merge, make sure the plan passes. After the merge, check the CloudWatch Logs Insight queries are created and corresponding alarms.
Release Instructions | Instructions pour le déploiement
None.
Reviewer checklist | Liste de vérification du réviseur