Skip to content

Latest commit

 

History

History

sns-standard-topic

sns-standard-topic

This module creates following resources.

  • aws_sns_topic
  • aws_sns_topic_data_protection_policy (optional)
  • aws_sns_topic_policy (optional)
  • aws_sns_topic_subscription (optional)

Requirements

Name Version
terraform >= 1.5
aws >= 5.5

Providers

Name Version
aws 5.19.0

Modules

Name Source Version
resource_group tedilabs/misc/aws//modules/resource-group ~> 0.10.0

Resources

Name Type
aws_sns_topic.this resource
aws_sns_topic_data_protection_policy.this resource
aws_sns_topic_policy.this resource
aws_sns_topic_subscription.email resource
aws_sns_topic_subscription.email_json resource
aws_sns_topic_subscription.lambda resource
aws_sns_topic_subscription.sqs resource
aws_iam_policy_document.this data source

Inputs

Name Description Type Default Required
name (Required) The name of the SNS topic. Topic names must be made up of only uppercase and lowercase ASCII letters, numbers, underscores, and hyphens, and must be between 1 and 256 characters long. string n/a yes
data_protection_policy (Optional) A valid policy JSON document. The data protection policy defines your own rules and policies to audit and control the content for data in motion, as opposed to data at rest. string null no
delivery_policy (Optional) The SNS delivery policy. string null no
display_name (Optional) The display name to use for a topic with SMS subscriptions. string "" no
encryption_at_rest (Optional) A configuration to encrypt at rest in the SNS topic. Amazon SNS provides in-transit encryption by default. Enabling server-side encryption adds at-rest encryption to your topic. Amazon SNS encrypts your message as soon as it is received. The message is decrypted immediately prior to delivery. encryption_at_rest as defined below.
(Optional) enabled - Whether to enable encryption at rest. Defaults to false.
(Optional) kms_key - The ID of AWS KMS CMK (Customer Master Key) used for the encryption.
object({
enabled = optional(bool, false)
kms_key = optional(string)
})
{} no
module_tags_enabled (Optional) Whether to create AWS Resource Tags for the module informations. bool true no
policy (Optional) A valid policy JSON document. The resource-based policy defines who can publish or subscribe to the SNS topic. string null no
resource_group_description (Optional) The description of Resource Group. string "Managed by Terraform." no
resource_group_enabled (Optional) Whether to create Resource Group to find and group AWS resources which are created by this module. bool true no
resource_group_name (Optional) The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with AWS or aws. string "" no
signature_version (Optional) The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS. Defaults to 1. number 1 no
subscriptions_by_email (Optional) A configuration for email subscriptions to the SNS topic. Deliver messages to the subscriber via SMTP. Until the subscription is confirmed, AWS does not allow Terraform to delete / unsubscribe the subscription. If you destroy an unconfirmed subscription, Terraform will remove the subscription from its state but the subscription will still exist in AWS. Each block of subscriptions_by_email as defined below.
(Required) email - An email address that can receive notifications from the SNS topic.
(Optional) filter_policy - The configuration to filter the messages that a subscriber receives. Additions or changes to the filter policy require up to 15 minutes to fully take effect. filter_policy as defined below.
(Optional) enabled - Whether to enable the filter policy. Defaults to false.
(Optional) scope - Determine how the filter policy will be applied to the message.
Valid values are ATTRIBUTES and BODY. Defaults to ATTRIBUTES.
ATTRIBUTES - The filter policy will be applied to the message attributes.
BODY - The filter policy will be applied to the message body.
(Optional) redrive_policy - The configuration to send undeliverable messages to a dead-letter queue. redrive_policy as defined below.
(Optional) dead_letter_sqs_queue - The ARN of the SQS queue to which Amazon SNS can send undeliverable messages.
list(object({
email = string
filter_policy = optional(object({
enabled = optional(bool, false)
scope = optional(string, "ATTRIBUTES")
policy = optional(string)
}), {})
redrive_policy = optional(object({
dead_letter_sqs_queue = optional(string)
}), {})
}))
[] no
subscriptions_by_email_json (Optional) A configuration for JSON-encoded email subscriptions to the SNS topic. Deliver JSON-encoded messages to the subscriber via SMTP. Until the subscription is confirmed, AWS does not allow Terraform to delete / unsubscribe the subscription. If you destroy an unconfirmed subscription, Terraform will remove the subscription from its state but the subscription will still exist in AWS. Each block of subscriptions_by_email_json as defined below.
(Required) email - An email address that can receive notifications from the SNS topic.
(Optional) filter_policy - The configuration to filter the messages that a subscriber receives. Additions or changes to the filter policy require up to 15 minutes to fully take effect. filter_policy as defined below.
(Optional) enabled - Whether to enable the filter policy. Defaults to false.
(Optional) scope - Determine how the filter policy will be applied to the message.
Valid values are ATTRIBUTES and BODY. Defaults to ATTRIBUTES.
ATTRIBUTES - The filter policy will be applied to the message attributes.
BODY - The filter policy will be applied to the message body.
(Optional) redrive_policy - The configuration to send undeliverable messages to a dead-letter queue. redrive_policy as defined below.
(Optional) dead_letter_sqs_queue - The ARN of the SQS queue to which Amazon SNS can send undeliverable messages.
list(object({
email = string
filter_policy = optional(object({
enabled = optional(bool, false)
scope = optional(string, "ATTRIBUTES")
policy = optional(string)
}), {})
redrive_policy = optional(object({
dead_letter_sqs_queue = optional(string)
}), {})
}))
[] no
subscriptions_by_lambda (Optional) A configuration for Lambda Function subscriptions to the SNS topic. Deliver JSON-encoded messages to the Lambda function. Each block of subscriptions_by_lambda as defined below.
(Required) name - The name of the subscription to the SNS topic. This value is only used internally within Terraform code.
(Required) function - The ARN of the AWS Lambda function that can receive notifications from the SNS topic.
(Optional) filter_policy - The configuration to filter the messages that a subscriber receives. Additions or changes to the filter policy require up to 15 minutes to fully take effect. filter_policy as defined below.
(Optional) enabled - Whether to enable the filter policy. Defaults to false.
(Optional) scope - Determine how the filter policy will be applied to the message.
Valid values are ATTRIBUTES and BODY. Defaults to ATTRIBUTES.
ATTRIBUTES - The filter policy will be applied to the message attributes.
BODY - The filter policy will be applied to the message body.
(Optional) redrive_policy - The configuration to send undeliverable messages to a dead-letter queue. redrive_policy as defined below.
(Optional) dead_letter_sqs_queue - The ARN of the SQS queue to which Amazon SNS can send undeliverable messages.
list(object({
name = string
function = string
filter_policy = optional(object({
enabled = optional(bool, false)
scope = optional(string, "ATTRIBUTES")
policy = optional(string)
}), {})
redrive_policy = optional(object({
dead_letter_sqs_queue = optional(string)
}), {})
}))
[] no
subscriptions_by_sqs (Optional) A configuration for SQS Queue subscriptions to the SNS topic. Deliver JSON-encoded messages to the SQS queue. Each block of subscriptions_by_sqs as defined below.
(Required) name - The name of the subscription to the SNS topic. This value is only used internally within Terraform code.
(Required) queue - The ARN of the AWS SQS queue that can receive notifications from the SNS topic.
(Optional) raw_message_delivery_enabled - Whether to enable raw message delivery. Raw messages are free of JSON formatting. Defaults to false.
(Optional) filter_policy - The configuration to filter the messages that a subscriber receives. Additions or changes to the filter policy require up to 15 minutes to fully take effect. filter_policy as defined below.
(Optional) enabled - Whether to enable the filter policy. Defaults to false.
(Optional) scope - Determine how the filter policy will be applied to the message.
Valid values are ATTRIBUTES and BODY. Defaults to ATTRIBUTES.
ATTRIBUTES - The filter policy will be applied to the message attributes.
BODY - The filter policy will be applied to the message body.
(Optional) redrive_policy - The configuration to send undeliverable messages to a dead-letter queue. redrive_policy as defined below.
(Optional) dead_letter_sqs_queue - The ARN of the SQS queue to which Amazon SNS can send undeliverable messages.
list(object({
name = string
queue = string
raw_message_delivery_enabled = optional(bool, false)
filter_policy = optional(object({
enabled = optional(bool, false)
scope = optional(string, "ATTRIBUTES")
policy = optional(string)
}), {})
redrive_policy = optional(object({
dead_letter_sqs_queue = optional(string)
}), {})
}))
[] no
tags (Optional) A map of tags to add to all resources. map(string) {} no
xray_tracing_enabled (Optional) Whether to activate AWS X-Ray Active Tracing mode for the SNS topic. If set to Active, Amazon SNS will vend X-Ray segment data to topic owner account if the sampled flag in the tracing header is true. Defaults to false, and the topic passes through the tracing header it receives from an Amazon SNS publisher to its subscriptions. bool false no

Outputs

Name Description
arn The ARN of the SNS topic.
display_name The display name for a topic with SMS subscriptions.
encryption_at_rest A configuration to encrypt at rest in the SNS topic.
id The ID of the SNS topic.
name The name for the SNS topic.
owner The AWS Account ID of the SNS topic owner.
signature_version The signature version corresponds to the hashing algorithm used while creating the signature of the notifications, subscription confirmations, or unsubscribe confirmation messages sent by Amazon SNS.
subscriptions The configurations for subscriptions to the SNS topic.
EMAIL -
type The type of the SNS topic.
xray_tracing_enabled Whether to activate AWS X-Ray Active Tracing mode for the SNS topic.