aws / aws/aws-cdk

aws-events: no way to set Id on Rule Target

Open
#37,025 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-events bug effort/medium p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

The API https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutTargets.html#API_PutTargets_RequestSyntax allows setting an `Id` value for a rule target. However, CDK does not appear to have a way to set this value, instead using values like `Target0`. (Having imported into CDK some infrastructure that had been created with the API, those resources now show as "drifted".)

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

Allow defining the `Id` of these resources.

### Current Behavior

No way to define the `Id`.

### Reproduction Steps

Try to set the `Id` of a rule target.

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.233.0

### AWS CDK CLI version

2.1100.3

### Node.js Version

24

### OS

MacOS

### Language

TypeScript

### Language Version

TypeScript (5.9.3)

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue points to the aws-events rule-target implementation and the AWS EventBridge PutTargets API; start by tracing how target IDs are synthesized. Completion means an explicit target Id can be defined and the synthesized or deployed resource uses that value rather than a generated Target0-style value, avoiding drift.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.