From ab660f7e86aec7a4f134036460b98eeb92c6c4c8 Mon Sep 17 00:00:00 2001 From: rysi3k Date: Thu, 18 May 2023 11:03:24 +0200 Subject: [PATCH] feat!: Added variable to filter body of message on SNS level and bumped min Terraform version to 1.0 (#196) Co-authored-by: Tomasz Rychlewicz Co-authored-by: Anton Babenko --- .pre-commit-config.yaml | 4 ++-- README.md | 3 ++- examples/cloudwatch-alerts-to-slack/README.md | 2 +- examples/cloudwatch-alerts-to-slack/versions.tf | 2 +- examples/notify-slack-simple/README.md | 2 +- examples/notify-slack-simple/versions.tf | 2 +- main.tf | 9 +++++---- variables.tf | 6 ++++++ versions.tf | 2 +- 9 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 74f3751c..4395e67e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 diff --git a/README.md b/README.md index cae49661..c31aa215 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ See the [functions](https://github.com/terraform-aws-modules/terraform-aws-notif | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.8 | ## Providers @@ -141,6 +141,7 @@ See the [functions](https://github.com/terraform-aws-modules/terraform-aws-notif | [sns\_topic\_name](#input\_sns\_topic\_name) | The name of the SNS topic to create | `string` | n/a | yes | | [sns\_topic\_tags](#input\_sns\_topic\_tags) | Additional tags for the SNS topic | `map(string)` | `{}` | no | | [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 | +| [subscription\_filter\_policy\_scope](#input\_subscription\_filter\_policy\_scope) | (Optional) A valid filter policy scope MessageAttributes\|MessageBody | `string` | `null` | no | | [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no | ## Outputs diff --git a/examples/cloudwatch-alerts-to-slack/README.md b/examples/cloudwatch-alerts-to-slack/README.md index 9ce81397..2b1ef3c3 100644 --- a/examples/cloudwatch-alerts-to-slack/README.md +++ b/examples/cloudwatch-alerts-to-slack/README.md @@ -60,7 +60,7 @@ Note that this example may create resources which can cost money. Run `terraform | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.8 | | [random](#requirement\_random) | >= 2.0 | diff --git a/examples/cloudwatch-alerts-to-slack/versions.tf b/examples/cloudwatch-alerts-to-slack/versions.tf index b19bca77..a68b547b 100644 --- a/examples/cloudwatch-alerts-to-slack/versions.tf +++ b/examples/cloudwatch-alerts-to-slack/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/examples/notify-slack-simple/README.md b/examples/notify-slack-simple/README.md index a364f5bf..6bc99a19 100644 --- a/examples/notify-slack-simple/README.md +++ b/examples/notify-slack-simple/README.md @@ -23,7 +23,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.13.1 | +| [terraform](#requirement\_terraform) | >= 1.0 | | [aws](#requirement\_aws) | >= 4.8 | | [local](#requirement\_local) | >= 2.0 | diff --git a/examples/notify-slack-simple/versions.tf b/examples/notify-slack-simple/versions.tf index 232eabdf..871ac043 100644 --- a/examples/notify-slack-simple/versions.tf +++ b/examples/notify-slack-simple/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = { diff --git a/main.tf b/main.tf index 16d83362..21f5d54b 100644 --- a/main.tf +++ b/main.tf @@ -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" { diff --git a/variables.tf b/variables.tf index 88a93283..e2539c04 100644 --- a/variables.tf +++ b/variables.tf @@ -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 +} diff --git a/versions.tf b/versions.tf index 756365d0..73fac5c5 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.13.1" + required_version = ">= 1.0" required_providers { aws = {