Skip to content

Commit

Permalink
feat: Add support for signature version (#42)
Browse files Browse the repository at this point in the history
Co-authored-by: magreenbaum <magreenbaum>
  • Loading branch information
magreenbaum authored Feb 25, 2023
1 parent b025824 commit b7d59e3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ module "sns_topic" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.40 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.56 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.40 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.56 |

## Modules

Expand Down Expand Up @@ -176,6 +176,7 @@ No modules.
| <a name="input_lambda_feedback"></a> [lambda\_feedback](#input\_lambda\_feedback) | Map of IAM role ARNs and sample rate for success and failure feedback | `map(string)` | `{}` | no |
| <a name="input_name"></a> [name](#input\_name) | The name of the SNS topic to create | `string` | `null` | no |
| <a name="input_override_topic_policy_documents"></a> [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 |
| <a name="input_signature_version"></a> [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 |
| <a name="input_source_topic_policy_documents"></a> [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 |
| <a name="input_sqs_feedback"></a> [sqs\_feedback](#input\_sqs\_feedback) | Map of IAM role ARNs and sample rate for success and failure feedback | `map(string)` | `{}` | no |
| <a name="input_subscriptions"></a> [subscriptions](#input\_subscriptions) | A map of subscription definitions to create | `any` | `{}` | no |
Expand Down
3 changes: 2 additions & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ locals {
module "default_sns" {
source = "../../"

name = "${local.name}-default"
name = "${local.name}-default"
signature_version = 2

tags = local.tags
}
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ resource "aws_sns_topic" "this" {
delivery_policy = var.delivery_policy
display_name = var.display_name
fifo_topic = var.fifo_topic
signature_version = var.fifo_topic ? null : var.signature_version

firehose_failure_feedback_role_arn = try(var.firehose_feedback.failure_role_arn, null)
firehose_success_feedback_role_arn = try(var.firehose_feedback.success_role_arn, null)
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ variable "sqs_feedback" {
# }
}

variable "signature_version" {
description = "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."
type = number
default = null
}

################################################################################
# Topic Policy
################################################################################
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.40"
version = ">= 4.56"
}
}
}
1 change: 1 addition & 0 deletions wrappers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module "wrapper" {
lambda_feedback = try(each.value.lambda_feedback, var.defaults.lambda_feedback, {})
topic_policy = try(each.value.topic_policy, var.defaults.topic_policy, null)
sqs_feedback = try(each.value.sqs_feedback, var.defaults.sqs_feedback, {})
signature_version = try(each.value.signature_version, var.defaults.signature_version, null)
create_topic_policy = try(each.value.create_topic_policy, var.defaults.create_topic_policy, true)
source_topic_policy_documents = try(each.value.source_topic_policy_documents, var.defaults.source_topic_policy_documents, [])
override_topic_policy_documents = try(each.value.override_topic_policy_documents, var.defaults.override_topic_policy_documents, [])
Expand Down

0 comments on commit b7d59e3

Please sign in to comment.