Closed BlissfulDarkness closed 1 year ago
@hindmanj Thanks for flagging the issue!
Can you help confirm if I understood the issue correctly? When you set enableXRayTracing
to true
, datadog macro tries to add the required X-Ray permissions to the IAM role. The findIamRole assumes that the IAM role is also defined in the same template. But in your use case, you have the IAM role predefined somewhere else (not as part of the template), therefore the macro fails because it cannot find the IAM role and add required permissions?
If my understanding is correct, I think the better fix instead of https://github.com/DataDog/datadog-cloudformation-macro/pull/70 is:
addXrayPolicies
)findIamRole
returns null (i.e., the role is defined somewhere else), instead of throw an error and stop (https://github.com/DataDog/datadog-cloudformation-macro/blob/21047dffdc4c1bc1094031c5b109f7e8e29f2dc8/serverless/src/tracing.ts#L95), the macro should only log
an error, and continue processing without calling the addXrayPolicies
function (assumes the permissions are already on the given role).What do you think?
Closing as there's been no update here. Please feel free to re-open if you want us to take another look!
Expected Behavior
Enabling X-Ray Tracing should not require a defined IAM Resource in the template, if an IAM role is being specifically provided that already has the needed permissions.
For the
enableXRayTracking
andenableDDTracing
options, a third value of "inherit" or "ignore" would resolve this, since all the required configuration can be done viaGlobals.Function
template specifications.Actual Behavior
If the DataDog Macro is given
enableXRayTracing: true
provided, it will fail to transform due to requiring an IAM Resource for that function.This behavior also blocks the way this could be done on an older version of the Macro, where you could configure the behavior by providing the required information as part of the
Global
section of the template.Steps to Reproduce the Problem
enableXRayTracing: true
for the DataDog MacroSpecifications
For the Datadog Serverless Macro:
Stacktrace