https://github.com/tomarv2/terraform-aws-sns
Terraform module for AWS SNS
https://github.com/tomarv2/terraform-aws-sns
sns sns-topic terraform terraform-module
Last synced: 7 months ago
JSON representation
Terraform module for AWS SNS
- Host: GitHub
- URL: https://github.com/tomarv2/terraform-aws-sns
- Owner: tomarv2
- License: apache-2.0
- Created: 2021-11-15T02:26:52.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-04T04:57:46.000Z (over 2 years ago)
- Last Synced: 2025-03-22T15:49:54.677Z (7 months ago)
- Topics: sns, sns-topic, terraform, terraform-module
- Language: HCL
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Terraform module for AWS SNS
### Versions
- Module tested for Terraform 1.0.1.
- AWS provider version [3.74](https://registry.terraform.io/providers/hashicorp/aws/latest).
- `main` branch: Provider versions not pinned to keep up with Terraform releases.
- `tags` releases: Tags are pinned with versions (use
in your releases).
### Usage
#### Option 1:
```
terrafrom init
terraform plan -var='teamid=tryme' -var='prjid=project1'
terraform apply -var='teamid=tryme' -var='prjid=project1'
terraform destroy -var='teamid=tryme' -var='prjid=project1'
```
**Note:** With this option please take care of remote state storage#### Option 2:
##### Recommended method (stores remote state in S3 using `prjid` and `teamid` to create directory structure):
- Create python 3.8+ virtual environment
```
python3 -m venv
```- Install package:
```
pip install tfremote --upgrade
```- Set below environment variables:
```
export TF_AWS_BUCKET=
export TF_AWS_BUCKET_REGION=us-west-2
export TF_AWS_PROFILE=
```or
- Set below environment variables:
```
export TF_AWS_BUCKET=
export TF_AWS_BUCKET_REGION=us-west-2
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
```- Updated `examples` directory with required values.
- Run and verify the output before deploying:
```
tf -c=aws plan -var='teamid=foo' -var='prjid=bar'
```- Run below to deploy:
```
tf -c=aws apply -var='teamid=foo' -var='prjid=bar'
```- Run below to destroy:
```
tf -c=aws destroy -var='teamid=foo' -var='prjid=bar'
```**Note:** Read more on [tfremote](https://github.com/tomarv2/tfremote)
##### SNS
```
module "sns" {
source = "../../"deploy_sns = true
sns_subscription = false
#-----------------------------------------------
# Note: Do not change teamid and prjid once set.
teamid = var.teamid
prjid = var.prjid
}
```Please refer to examples directory [link](examples) for references.
## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0.1 |
| [aws](#requirement\_aws) | ~> 3.74 |## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | ~> 3.74 |## 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_subscription.sns_subscription](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [application\_failure\_feedback\_role\_arn](#input\_application\_failure\_feedback\_role\_arn) | IAM role for failure feedback | `string` | `null` | no |
| [application\_success\_feedback\_role\_arn](#input\_application\_success\_feedback\_role\_arn) | IAM role for success feedback | `string` | `null` | no |
| [application\_success\_feedback\_sample\_rate](#input\_application\_success\_feedback\_sample\_rate) | Percentage of success to sample | `string` | `null` | no |
| [content\_based\_deduplication](#input\_content\_based\_deduplication) | Boolean that toggles content-based deduplication for FIFO topics | `bool` | `false` | no |
| [custom\_tags](#input\_custom\_tags) | Extra custom tags | `any` | `null` | no |
| [delivery\_policy](#input\_delivery\_policy) | SNS delivery policy | `string` | `null` | no |
| [deploy\_sns](#input\_deploy\_sns) | Feature flag, true or false | `bool` | `true` | no |
| [display\_name](#input\_display\_name) | Display name for the topic | `string` | `null` | no |
| [endpoint](#input\_endpoint) | Endpoint to send data to. The contents vary with the protocol. | `string` | `null` | no |
| [fifo\_topic](#input\_fifo\_topic) | Boolean indicating whether or not to create a FIFO (first-in-first-out) topic | `bool` | `false` | no |
| [firehose\_failure\_feedback\_role\_arn](#input\_firehose\_failure\_feedback\_role\_arn) | IAM role for failure feedback | `string` | `null` | no |
| [firehose\_success\_feedback\_role\_arn](#input\_firehose\_success\_feedback\_role\_arn) | IAM role for success feedback | `string` | `null` | no |
| [firehose\_success\_feedback\_sample\_rate](#input\_firehose\_success\_feedback\_sample\_rate) | Percentage of success to sample | `string` | `null` | no |
| [http\_failure\_feedback\_role\_arn](#input\_http\_failure\_feedback\_role\_arn) | IAM role for failure feedback | `string` | `null` | no |
| [http\_success\_feedback\_role\_arn](#input\_http\_success\_feedback\_role\_arn) | IAM role for success feedback | `string` | `null` | no |
| [http\_success\_feedback\_sample\_rate](#input\_http\_success\_feedback\_sample\_rate) | Percentage of success to sample | `string` | `null` | no |
| [kms\_master\_key\_id](#input\_kms\_master\_key\_id) | ID of an AWS-managed KMS key for Amazon SNS or a custom KMS key | `string` | `null` | no |
| [lambda\_failure\_feedback\_role\_arn](#input\_lambda\_failure\_feedback\_role\_arn) | IAM role for failure feedback | `string` | `null` | no |
| [lambda\_success\_feedback\_role\_arn](#input\_lambda\_success\_feedback\_role\_arn) | IAM role for success feedback | `string` | `null` | no |
| [lambda\_success\_feedback\_sample\_rate](#input\_lambda\_success\_feedback\_sample\_rate) | Percentage of success to sample | `string` | `null` | no |
| [name](#input\_name) | Name of the topic. For a FIFO (first-in-first-out) topic, the name must end with the .fifo suffix | `string` | `null` | no |
| [policy](#input\_policy) | Fully-formed AWS policy as JSON | `string` | `null` | no |
| [prjid](#input\_prjid) | Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply' | `string` | n/a | yes |
| [sns\_subscription](#input\_sns\_subscription) | Feature flag, true or false | `bool` | `true` | no |
| [sqs\_failure\_feedback\_role\_arn](#input\_sqs\_failure\_feedback\_role\_arn) | IAM role for failure feedback | `string` | `null` | no |
| [sqs\_success\_feedback\_role\_arn](#input\_sqs\_success\_feedback\_role\_arn) | IAM role for success feedback | `string` | `null` | no |
| [sqs\_success\_feedback\_sample\_rate](#input\_sqs\_success\_feedback\_sample\_rate) | Percentage of success to sample | `string` | `null` | no |
| [subscription\_protocol](#input\_subscription\_protocol) | Feature flag, true or false | `string` | `"sqs"` | no |
| [teamid](#input\_teamid) | Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply' | `string` | n/a | yes |## Outputs
| Name | Description |
|------|-------------|
| [sns\_topic\_arn](#output\_sns\_topic\_arn) | The ARN of the SNS topic |
| [sns\_topic\_name](#output\_sns\_topic\_name) | The name of the SNS topic |