On the console, there’s the option to enable active tracking for X-ray tracking but I can see this in the Terraform aws_lambda_function resource the aws_xray_sampling_rule resources?

I'm currently manually enabling it in the console to enable me to test it but I'd like to enable it through Terraform when I build the Lambda?

1 Answer 1


This looks like it was added to Terraform back in May 2017, you enable it with the tracing_config block:

tracing_config {
  mode = "Active"

You will also need to make sure that Terraform has a minimum of Write access to X-ray to enable the above to work:

data "aws_iam_policy" "aws_xray_write_only_access" {
  arn = "arn:aws:iam::aws:policy/AWSXrayWriteOnlyAccess"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.