From e6f91ab1aacc57bcce419c96dd9e0895c67e886a Mon Sep 17 00:00:00 2001 From: nolivermke Date: Mon, 12 Jul 2021 11:52:47 -0500 Subject: [PATCH] Enable Xray tracing on Step Function if set to true in service_integrations --- main.tf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.tf b/main.tf index aef754b..14677fa 100644 --- a/main.tf +++ b/main.tf @@ -4,6 +4,8 @@ locals { enable_logging = try(var.logging_configuration["level"], "OFF") != "OFF" + enable_xray_tracing = try(var.service_integrations["xray"]["xray"], false) == true + # Normalize ARN by trimming ":*" because data-source has it, but resource does not have it log_group_arn = trimsuffix(element(concat(data.aws_cloudwatch_log_group.sfn.*.arn, aws_cloudwatch_log_group.sfn.*.arn, [""]), 0), ":*") @@ -28,6 +30,13 @@ resource "aws_sfn_state_machine" "this" { } } + dynamic "tracing_configuration" { + for_each = local.enable_xray_tracing ? [true] : [] + content { + enabled = true + } + } + type = upper(var.type) tags = merge({ Name = var.name }, var.tags)