Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/terraform-aws-modules/terraform-aws-sns
Terraform module to create AWS SNS resources πΊπ¦
https://github.com/terraform-aws-modules/terraform-aws-sns
sns sns-topic terraform-module
Last synced: about 1 month ago
JSON representation
Terraform module to create AWS SNS resources πΊπ¦
- Host: GitHub
- URL: https://github.com/terraform-aws-modules/terraform-aws-sns
- Owner: terraform-aws-modules
- License: apache-2.0
- Created: 2017-09-26T08:41:27.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-05T11:59:02.000Z (5 months ago)
- Last Synced: 2024-09-27T19:01:20.605Z (about 2 months ago)
- Topics: sns, sns-topic, terraform-module
- Language: HCL
- Homepage: https://registry.terraform.io/modules/terraform-aws-modules/sns/aws
- Size: 78.1 KB
- Stars: 95
- Watchers: 9
- Forks: 159
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS SNS Topic Terraform module
Terraform module which creates SNS resources on AWS
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
## Usage
### Simple Topic
```hcl
module "sns_topic" {
source = "terraform-aws-modules/sns/aws"name = "simple"
tags = {
Environment = "dev"
Terraform = "true"
}
}
```### Topic w/ SQS Subscription
```hcl
module "sns_topic" {
source = "terraform-aws-modules/sns/aws"name = "pub-sub"
topic_policy_statements = {
pub = {
actions = ["sns:Publish"]
principals = [{
type = "AWS"
identifiers = ["arn:aws:iam::66666666666:role/publisher"]
}]
},sub = {
actions = [
"sns:Subscribe",
"sns:Receive",
]principals = [{
type = "AWS"
identifiers = ["*"]
}]conditions = [{
test = "StringLike"
variable = "sns:Endpoint"
values = ["arn:aws:sqs:eu-west-1:11111111111:subscriber"]
}]
}
}subscriptions = {
sqs = {
protocol = "sqs"
endpoint = "arn:aws:sqs:eu-west-1:11111111111:subscriber"
}
}tags = {
Environment = "dev"
Terraform = "true"
}
}
```### FIFO Topic w/ FIFO SQS Subscription
```hcl
module "sns_topic" {
source = "terraform-aws-modules/sns/aws"name = "my-topic"
# SQS queue must be FIFO as well
fifo_topic = true
content_based_deduplication = truetopic_policy_statements = {
pub = {
actions = ["sns:Publish"]
principals = [{
type = "AWS"
identifiers = ["arn:aws:iam::66666666666:role/publisher"]
}]
},sub = {
actions = [
"sns:Subscribe",
"sns:Receive",
]principals = [{
type = "AWS"
identifiers = ["*"]
}]conditions = [{
test = "StringLike"
variable = "sns:Endpoint"
values = ["arn:aws:sqs:eu-west-1:11111111111:subscriber.fifo"]
}]
}
}subscriptions = {
sqs = {
protocol = "sqs"
endpoint = "arn:aws:sqs:eu-west-1:11111111111:subscriber.fifo"
}
}tags = {
Environment = "dev"
Terraform = "true"
}
}
```## Examples
- [Complete](https://github.com/terraform-aws-modules/terraform-aws-sns/tree/master/examples/complete)
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0 |
| [aws](#requirement\_aws) | >= 5.25 |## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | >= 5.25 |## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_sns_topic.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic) | resource |
| [aws_sns_topic_data_protection_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_data_protection_policy) | resource |
| [aws_sns_topic_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_policy) | resource |
| [aws_sns_topic_subscription.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [application\_feedback](#input\_application\_feedback) | Map of IAM role ARNs and sample rate for success and failure feedback | `map(string)` | `{}` | no |
| [archive\_policy](#input\_archive\_policy) | The message archive policy for FIFO topics. | `string` | `null` | no |
| [content\_based\_deduplication](#input\_content\_based\_deduplication) | Boolean indicating whether or not to enable content-based deduplication for FIFO topics. | `bool` | `false` | no |
| [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
| [create\_subscription](#input\_create\_subscription) | Determines whether an SNS subscription is created | `bool` | `true` | no |
| [create\_topic\_policy](#input\_create\_topic\_policy) | Determines whether an SNS topic policy is created | `bool` | `true` | no |
| [data\_protection\_policy](#input\_data\_protection\_policy) | A map of data protection policy statements | `string` | `null` | no |
| [delivery\_policy](#input\_delivery\_policy) | The SNS delivery policy | `string` | `null` | no |
| [display\_name](#input\_display\_name) | The display name for the SNS topic | `string` | `null` | no |
| [enable\_default\_topic\_policy](#input\_enable\_default\_topic\_policy) | Specifies whether to enable the default topic policy. Defaults to `true` | `bool` | `true` | no |
| [fifo\_topic](#input\_fifo\_topic) | Boolean indicating whether or not to create a FIFO (first-in-first-out) topic | `bool` | `false` | no |
| [firehose\_feedback](#input\_firehose\_feedback) | Map of IAM role ARNs and sample rate for success and failure feedback | `map(string)` | `{}` | no |
| [http\_feedback](#input\_http\_feedback) | Map of IAM role ARNs and sample rate for success and failure feedback | `map(string)` | `{}` | no |
| [kms\_master\_key\_id](#input\_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](#input\_lambda\_feedback) | Map of IAM role ARNs and sample rate for success and failure feedback | `map(string)` | `{}` | no |
| [name](#input\_name) | The name of the SNS topic to create | `string` | `null` | no |
| [override\_topic\_policy\_documents](#input\_override\_topic\_policy\_documents) | List of IAM policy documents that are merged together into the exported document. In merging, statements with non-blank `sid`s will override statements with the same `sid` | `list(string)` | `[]` | no |
| [signature\_version](#input\_signature\_version) | If SignatureVersion should be 1 (SHA1) or 2 (SHA256). 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. | `number` | `null` | no |
| [source\_topic\_policy\_documents](#input\_source\_topic\_policy\_documents) | List of IAM policy documents that are merged together into the exported document. Statements must have unique `sid`s | `list(string)` | `[]` | no |
| [sqs\_feedback](#input\_sqs\_feedback) | Map of IAM role ARNs and sample rate for success and failure feedback | `map(string)` | `{}` | no |
| [subscriptions](#input\_subscriptions) | A map of subscription definitions to create | `any` | `{}` | no |
| [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
| [topic\_policy](#input\_topic\_policy) | An externally created fully-formed AWS policy as JSON | `string` | `null` | no |
| [topic\_policy\_statements](#input\_topic\_policy\_statements) | A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | `any` | `{}` | no |
| [tracing\_config](#input\_tracing\_config) | Tracing mode of an Amazon SNS topic. Valid values: PassThrough, Active. | `string` | `null` | no |
| [use\_name\_prefix](#input\_use\_name\_prefix) | Determines whether `name` is used as a prefix | `bool` | `false` | no |## Outputs
| Name | Description |
|------|-------------|
| [subscriptions](#output\_subscriptions) | Map of subscriptions created and their attributes |
| [topic\_arn](#output\_topic\_arn) | The ARN of the SNS topic, as a more obvious property (clone of id) |
| [topic\_beginning\_archive\_time](#output\_topic\_beginning\_archive\_time) | The oldest timestamp at which a FIFO topic subscriber can start a replay |
| [topic\_id](#output\_topic\_id) | The ARN of the SNS topic |
| [topic\_name](#output\_topic\_name) | The name of the topic |
| [topic\_owner](#output\_topic\_owner) | The AWS Account ID of the SNS topic owner |## Authors
Module is maintained by [Anton Babenko](https://github.com/antonbabenko) with help from [these awesome contributors](https://github.com/terraform-aws-modules/terraform-aws-sns/graphs/contributors).
## License
Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-sns/tree/master/LICENSE) for full details.