Skip to main content

SNS Topic Basic

πŸ“¦ Overview​

This Terraform module provisions a basic Amazon SNS topic, allowing for distributed pub/sub messaging across systems and services.

It’s ideal for enabling alerting, automation triggers, and decoupled communication between AWS services or microservices.


βœ… Key Features​

  • Creates a named SNS topic in the specified region
  • Supports optional display name and KMS encryption
  • Enables integration with Lambda, SQS, Email, and more
  • Facilitates cross-service event distribution and notifications

πŸ’Ό Use Cases​

  • Broadcasting system alerts or application notifications
  • Decoupling services using pub/sub patterns
  • Routing messages from one system to multiple subscribers
  • Triggering workflows like Lambda functions, Step Functions, or Ops pipelines

πŸ“₯ Input Variables​

NameTypeDescription
regionstringAWS region where the SNS topic will be created
topic_namestringName of the SNS topic
display_namestring(Optional) Display name for SMS-based topics
kms_key_arnstring(Optional) ARN of the KMS key to enable encryption
environmentstringTag to specify the deployment environment (e.g., prod, dev)

πŸ“€ Outputs​

NameDescription
sns_topic_arnThe ARN of the created SNS topic
sns_topic_nameThe name of the created SNS topic
regionThe AWS region where the topic was deployed

πŸš€ Deployment Readiness​

  • βœ… Compatible with Terraform 1.0+
  • βœ… Tested with AWS provider 5.x
  • πŸ§ͺ Supports optional KMS encryption and custom display names

πŸ› οΈ Example Usage​

module "sns_topic_basic" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//developer-utilities/sns-topic-basic?ref=v1.0.0"

region = "us-east-1"
topic_name = "alerts-topic"
display_name = "Alerts"
kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/abc123-example"
environment = "prod"
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

🧹 Cleanup Options​

For testing:

terraform destroy

or

tofu destroy

For production:

Manually delete the SNS topic via the AWS Console or CLI if it is linked to workflows, alerting systems, or critical subscribers.

πŸ›‘οΈ Notes​

This is a Level 1 event and messaging module for provisioning SNS topics. For more advanced pub/sub patterns, extend with filtered subscriptions, cross-account publish permissions, or event-to-pipeline integrations.

πŸ”’ Deployment Package Notice​

This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.