Skip to content

Commit

Permalink
fix: disable module output interpolation when not creating dlq (#62)
Browse files Browse the repository at this point in the history
## Description
Disable the interpolation of the dlq alarm description when not creating
one as that leads to null string interpolation errors. Also use the
correct alarm description variable for dlq alarm descriptions.
  • Loading branch information
bt-justtrack authored Oct 15, 2024
1 parent 9cd5337 commit 63dd678
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ locals {
alarm_description = var.alarm.description != null ? var.alarm.description : "SQS Queue Metrics: https://${module.this.aws_region}.console.aws.amazon.com/sqs/v2/home?region=${module.this.aws_region}#/queues/https%3A%2F%2Fsqs.${module.this.aws_region}.amazonaws.com%2F${module.this.aws_account_id}%2F${module.sqs.queue_name}"
alarm_topic_arn = var.alarm_topic_arn != null ? var.alarm_topic_arn : "arn:aws:sns:${module.this.aws_region}:${module.this.aws_account_id}:${module.this.environment}-alarms"
dlq_alarm_enabled = var.alarm_enabled && var.dlq_alarm_enabled
dlq_alarm_description = var.alarm.description != null ? var.alarm.description : "SQS Queue Metrics: https://${module.this.aws_region}.console.aws.amazon.com/sqs/v2/home?region=${module.this.aws_region}#/queues/https%3A%2F%2Fsqs.${module.this.aws_region}.amazonaws.com%2F${module.this.aws_account_id}%2F${module.sqs.dead_letter_queue_name}"
dlq_alarm_description = var.dlq_alarm.description != null ? var.dlq_alarm.description : (var.dlq_enabled ? "SQS Queue Metrics: https://${module.this.aws_region}.console.aws.amazon.com/sqs/v2/home?region=${module.this.aws_region}#/queues/https%3A%2F%2Fsqs.${module.this.aws_region}.amazonaws.com%2F${module.this.aws_account_id}%2F${module.sqs.dead_letter_queue_name}" : "")
}

resource "aws_cloudwatch_metric_alarm" "backlog" {
Expand Down

0 comments on commit 63dd678

Please sign in to comment.