Skip to content

DataDogStepFunctions with Multiple add_state_machines Invocations Fails Due to LogGroup Collision #666

Description

@mjdean94

Expected Behavior

A CDK synth should still work if add_state_machines is called multiple times.

Actual Behavior

CDK synth fails with "There is already a Construct with name 'LogGroup' in DatadogStepFunctions." Removing the existing logging configuration on the statemachine seems to fix this.

Steps to Reproduce the Problem

  1. Define two statemachines with log groups.
self.my_statemachine_one = steps.StateMachine(self, "StatemachineOne", logs=steps.LogOptions(destination=self.statemachine_one_log_group, level=steps.LogLevel.ALL)
self.my_statemachine_two = steps.StateMachine(self, "StatemachineTwo", logs=steps.LogOptions(destination=self.statemachine_two_log_group, level=steps.LogLevel.ALL)
  1. Define DatadogStepFunctions construct.
self.datadog_step_functions = DataDogStepFunctions(self, "DDStep", forwarder_arn=dd_forwarder_arn) 
  1. Call add_state_machines twice.
self.datadog_step_functions.add_state_machines([self.my_statemachine_one])
self.datadog_step_functions.add_state_machines([self.my_statemachine_two])
  1. Run a CDK synth. Build fails.

Specifications

  • datadog-cdk-constructs-v2>=4.2.0
  • python>=3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions