Skip to content

Commit

Permalink
feat!: Added variable to filter body of message on SNS level and bump…
Browse files Browse the repository at this point in the history
…ed min Terraform version to 1.0 (#196)

Co-authored-by: Tomasz Rychlewicz <tomasz.rychlewicz@explaineverything.com>
Co-authored-by: Anton Babenko <anton@antonbabenko.com>
  • Loading branch information
3 people authored May 18, 2023
1 parent 1882017 commit ab660f7
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.76.0
rev: v1.79.1
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand All @@ -23,7 +23,7 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ See the [functions](https://github.com/terraform-aws-modules/terraform-aws-notif

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.8 |

## Providers
Expand Down Expand Up @@ -141,6 +141,7 @@ See the [functions](https://github.com/terraform-aws-modules/terraform-aws-notif
| <a name="input_sns_topic_name"></a> [sns\_topic\_name](#input\_sns\_topic\_name) | The name of the SNS topic to create | `string` | n/a | yes |
| <a name="input_sns_topic_tags"></a> [sns\_topic\_tags](#input\_sns\_topic\_tags) | Additional tags for the SNS topic | `map(string)` | `{}` | no |
| <a name="input_subscription_filter_policy"></a> [subscription\_filter\_policy](#input\_subscription\_filter\_policy) | (Optional) A valid filter policy that will be used in the subscription to filter messages seen by the target resource. | `string` | `null` | no |
| <a name="input_subscription_filter_policy_scope"></a> [subscription\_filter\_policy\_scope](#input\_subscription\_filter\_policy\_scope) | (Optional) A valid filter policy scope MessageAttributes\|MessageBody | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |

## Outputs
Expand Down
2 changes: 1 addition & 1 deletion examples/cloudwatch-alerts-to-slack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Note that this example may create resources which can cost money. Run `terraform

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.8 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.0 |

Expand Down
2 changes: 1 addition & 1 deletion examples/cloudwatch-alerts-to-slack/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
Expand Down
2 changes: 1 addition & 1 deletion examples/notify-slack-simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.8 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 2.0 |

Expand Down
2 changes: 1 addition & 1 deletion examples/notify-slack-simple/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
Expand Down
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ resource "aws_sns_topic" "this" {
resource "aws_sns_topic_subscription" "sns_notify_slack" {
count = var.create ? 1 : 0

topic_arn = local.sns_topic_arn
protocol = "lambda"
endpoint = module.lambda.lambda_function_arn
filter_policy = var.subscription_filter_policy
topic_arn = local.sns_topic_arn
protocol = "lambda"
endpoint = module.lambda.lambda_function_arn
filter_policy = var.subscription_filter_policy
filter_policy_scope = var.subscription_filter_policy_scope
}

module "lambda" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,9 @@ variable "subscription_filter_policy" {
type = string
default = null
}

variable "subscription_filter_policy_scope" {
description = "(Optional) A valid filter policy scope MessageAttributes|MessageBody"
type = string
default = null
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
Expand Down

0 comments on commit ab660f7

Please sign in to comment.