From e34c16dcab54dd4b97be6fe27e2ff56484de6303 Mon Sep 17 00:00:00 2001 From: Tony Yip Date: Mon, 10 Apr 2023 13:53:24 +0800 Subject: [PATCH 1/5] feat: add support for tracing_config Signed-off-by: Tony Yip --- main.tf | 1 + variables.tf | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/main.tf b/main.tf index f9e0cbe..4efe304 100644 --- a/main.tf +++ b/main.tf @@ -19,6 +19,7 @@ resource "aws_sns_topic" "this" { display_name = var.display_name fifo_topic = var.fifo_topic signature_version = var.fifo_topic ? null : var.signature_version + tracing_config = var.tracing_config 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) diff --git a/variables.tf b/variables.tf index 485f2b7..edac1f6 100644 --- a/variables.tf +++ b/variables.tf @@ -128,6 +128,12 @@ variable "signature_version" { default = null } +variable "tracing_config" { + description = "Tracing mode of an Amazon SNS topic. Valid values: PassThrough, Active. (default: PassThrough)" + type = string + default = "PassThrough" +} + ################################################################################ # Topic Policy ################################################################################ From 9f3576138969d0be929d46a7baf464797f9df368 Mon Sep 17 00:00:00 2001 From: Tony Yip Date: Mon, 10 Apr 2023 14:08:16 +0800 Subject: [PATCH 2/5] docs: update example --- examples/complete/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 6a1ffd1..9f6997b 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -58,6 +58,7 @@ module "complete_sns" { use_name_prefix = true display_name = "complete" kms_master_key_id = module.kms.key_id + tracing_config = "Active" # SQS queue must be FIFO as well fifo_topic = true From 623c9bca4d30906e45f8726e3b6bdf6d3e695071 Mon Sep 17 00:00:00 2001 From: Tony Yip Date: Mon, 10 Apr 2023 14:13:36 +0800 Subject: [PATCH 3/5] docs: Update README.md Signed-off-by: Tony Yip --- README.md | 1 + wrappers/main.tf | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 92b40d4..f7855b1 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,7 @@ No modules. | [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. (default: PassThrough) | `string` | `"PassThrough"` | no | | [use\_name\_prefix](#input\_use\_name\_prefix) | Determines whether `name` is used as a prefix | `bool` | `false` | no | ## Outputs diff --git a/wrappers/main.tf b/wrappers/main.tf index 88a6b19..1cbd7a6 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -19,6 +19,7 @@ module "wrapper" { 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) + tracing_config = try(each.value.tracing_config, var.defaults.tracing_config, "PassThrough") 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, []) From 81398235b9f37855cace76d4d50f69bddec0ce24 Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Mon, 10 Apr 2023 10:14:27 +0200 Subject: [PATCH 4/5] Update variables.tf --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index edac1f6..a483677 100644 --- a/variables.tf +++ b/variables.tf @@ -129,7 +129,7 @@ variable "signature_version" { } variable "tracing_config" { - description = "Tracing mode of an Amazon SNS topic. Valid values: PassThrough, Active. (default: PassThrough)" + description = "Tracing mode of an Amazon SNS topic. Valid values: PassThrough, Active." type = string default = "PassThrough" } From b2e396c8ac6410e9f2f629f57df80a4f26f2b2e8 Mon Sep 17 00:00:00 2001 From: Tony Yip Date: Mon, 10 Apr 2023 16:23:04 +0800 Subject: [PATCH 5/5] feat: change variable default to null to use provider default Signed-off-by: Tony Yip --- README.md | 2 +- variables.tf | 2 +- wrappers/main.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f7855b1..82e9734 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,7 @@ No modules. | [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. (default: PassThrough) | `string` | `"PassThrough"` | 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 diff --git a/variables.tf b/variables.tf index a483677..ca5460d 100644 --- a/variables.tf +++ b/variables.tf @@ -131,7 +131,7 @@ variable "signature_version" { variable "tracing_config" { description = "Tracing mode of an Amazon SNS topic. Valid values: PassThrough, Active." type = string - default = "PassThrough" + default = null } ################################################################################ diff --git a/wrappers/main.tf b/wrappers/main.tf index 1cbd7a6..448c9eb 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -19,7 +19,7 @@ module "wrapper" { 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) - tracing_config = try(each.value.tracing_config, var.defaults.tracing_config, "PassThrough") + tracing_config = try(each.value.tracing_config, var.defaults.tracing_config, 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, [])