diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index b405336..289e29e 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 1.3.0" required_providers { aws = { source = "hashicorp/aws" diff --git a/main.tf b/main.tf index 4f58382..5a379e1 100644 --- a/main.tf +++ b/main.tf @@ -29,13 +29,15 @@ resource "aws_sns_topic" "this" { resource "aws_sns_topic_subscription" "this" { for_each = local.enabled ? var.subscribers : {} - topic_arn = join("", aws_sns_topic.this.*.arn) + topic_arn = join("", aws_sns_topic.this[*].arn) protocol = var.subscribers[each.key].protocol endpoint = var.subscribers[each.key].endpoint endpoint_auto_confirms = var.subscribers[each.key].endpoint_auto_confirms + filter_policy = var.subscribers[each.key].filter_policy + filter_policy_scope = var.subscribers[each.key].filter_policy_scope raw_message_delivery = var.subscribers[each.key].raw_message_delivery redrive_policy = var.sqs_dlq_enabled ? coalesce(var.redrive_policy, jsonencode({ - deadLetterTargetArn = join("", aws_sqs_queue.dead_letter_queue.*.arn) + deadLetterTargetArn = join("", aws_sqs_queue.dead_letter_queue[*].arn) maxReceiveCount = var.redrive_policy_max_receiver_count })) : null } diff --git a/variables.tf b/variables.tf index cb4a0bb..8f5c151 100644 --- a/variables.tf +++ b/variables.tf @@ -4,9 +4,13 @@ variable "subscribers" { # The protocol to use. The possible values for this are: sqs, sms, lambda, application. (http or https are partially supported, see below) (email is an option but is unsupported, see below). endpoint = string # The endpoint to send data to, the contents will vary with the protocol. (see below for more information) - endpoint_auto_confirms = bool + endpoint_auto_confirms = optional(bool, false) # Boolean indicating whether the end point is capable of auto confirming subscription e.g., PagerDuty (default is false) - raw_message_delivery = bool + filter_policy = optional(string, null) + # The filter policy JSON that is assigned to the subscription. For more information, see Amazon SNS Filter Policies. + filter_policy_scope = optional(string, "MessageAttributes") + # The filter policy scope that is assigned to the subscription. Whether the `filter_policy` applies to `MessageAttributes` (default) or `MessageBody` + raw_message_delivery = optional(bool, false) # Boolean indicating whether or not to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property) (default is false) })) description = "Required configuration for subscibres to SNS topic." diff --git a/versions.tf b/versions.tf index 85d1d00..00dcc71 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 1.3.0" required_providers { aws = {