Skip to content

Module Banner

terraform-aws-arc-sns

Module: sourcefuse/arc-sns/aws

Registry: https://registry.terraform.io/modules/sourcefuse/arc-sns/aws

Category: Messaging / Notifications

Source: https://github.com/sourcefuse/terraform-aws-arc-sns

Latest Release Last Updated Terraform GitHub Actions

Quality gate

Overview

Creates SNS topics with subscriptions, KMS encryption, access policies, and FIFO support.

Architecture

Architecture Diagram

What It Does

  • Standard and FIFO SNS topics
  • Email, SQS, Lambda, HTTP/S, and SMS subscriptions
  • KMS encryption for message data
  • Topic access policy management
  • Message filtering policies
  • Dead letter queue for failed deliveries

For more information about this repository and its usage, please see Terraform AWS SNS Usage Guide.

Quickstart

1
2
3
4
5
6
7
8
9
module "sns" {
  source               = "sourcefuse/arc-sns/aws"
  version              = "0.0.1"

  name                 = var.topic_name
  display_name         = var.display_name

  tags = module.tags.tags
}

Required Inputs

Name Type Description
name string SNS topic name
## Key Outputs
Name Description
topic_arn SNS topic ARN
topic_name SNS topic name
## Full Variable & Output Reference

The complete inputs/outputs reference is auto-generated below.

Requirements

Name Version
terraform >= 1.5.0
aws ~> 5.0

Providers

Name Version
aws 4.67.0

Modules

No modules.

Resources

Name Type
aws_lambda_permission.external_lambda resource
aws_lambda_permission.sns_invoke resource
aws_sns_topic.this resource
aws_sns_topic_subscription.this resource

Inputs

Name Description Type Default Required
application_feedback Map of IAM role ARNs and sample rate for success and failure feedback
object({
failure_role_arn = optional(string)
success_role_arn = optional(string)
success_sample_rate = optional(number)
})
{} no
archive_policy The message archive policy for FIFO topics string null no
content_based_deduplication Enables content-based deduplication for FIFO topics bool false no
create_subscription Whether to create SNS subscriptions bool true no
create_topic Whether to create the SNS topic bool true no
delivery_policy The SNS delivery policy string null no
display_name Display name for the SNS topic string null no
fifo_throughput_scope Enables higher throughput for FIFO topics by adjusting the scope of deduplication. Valid values: Topic, MessageGroup string null no
fifo_topic Boolean indicating whether or not to create a FIFO (first-in-first-out) topic bool false no
firehose_feedback Map of IAM role ARNs and sample rate for success and failure feedback
object({
failure_role_arn = optional(string)
success_role_arn = optional(string)
success_sample_rate = optional(number)
})
{} no
http_feedback Map of IAM role ARNs and sample rate for success and failure feedback
object({
failure_role_arn = optional(string)
success_role_arn = optional(string)
success_sample_rate = optional(number)
})
{} no
kms_master_key_id The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK string null no
lambda_feedback Map of IAM role ARNs and sample rate for success and failure feedback
object({
failure_role_arn = optional(string)
success_role_arn = optional(string)
success_sample_rate = optional(number)
})
{} no
lambda_permissions Map of Lambda function ARNs that should be granted permission to be invoked by this SNS topic map(string) {} no
name Name of the SNS topic string n/a yes
policy The fully-formed AWS policy as JSON string null no
signature_version The signature version corresponds to the hashing algorithm used while creating the signature of the notifications number null no
sqs_feedback Map of IAM role ARNs and sample rate for success and failure feedback
object({
failure_role_arn = optional(string)
success_role_arn = optional(string)
success_sample_rate = optional(number)
})
{} no
subscriptions A map of subscription configurations
map(object({
protocol = string
endpoint = string
confirmation_timeout_in_minutes = optional(number, 1)
endpoint_auto_confirms = optional(bool, false)
raw_message_delivery = optional(bool, false)
filter_policy = optional(string)
filter_policy_scope = optional(string)
delivery_policy = optional(string)
redrive_policy = optional(string)
}))
{} no
tags A map of tags to assign to the resource map(string) {} no
tracing_config Tracing mode of an Amazon SNS topic string null no
use_name_prefix Determines whether name is used as a prefix bool false no

Outputs

Name Description
subscriptions Map of subscriptions created and their attributes
topic_arn The ARN of the SNS topic
topic_display_name The display name of the SNS topic
topic_id The ID of the SNS topic
topic_name The name of the SNS topic
topic_owner The AWS Account ID of the SNS topic owner

Versioning

This project uses a .version file at the root of the repo which the pipeline reads from and does a git tag.

When you intend to commit to main, you will need to increment this version. Once the project is merged, the pipeline will kick off and tag the latest git commit.

Development

Prerequisites

Configurations

  • Configure pre-commit hooks
    pre-commit install
    

Versioning

while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch

For Example

git commit -m "your commit message #major"
By specifying this , it will bump the version and if you don't specify this in your commit message then by default it will consider patch and will bump that accordingly

Tests

  • Tests are available in test directory
  • Configure the dependencies
    1
    2
    3
    cd test/
    go mod init github.com/sourcefuse/terraform-aws-refarch-<module_name>
    go get github.com/gruntwork-io/terratest/modules/terraform
    
  • Now execute the test
    go test -timeout  30m
    

Contributing

See CONTRIBUTING.md for commit conventions and development setup.

Authors

This project is authored by: - SourceFuse ARC Team