Skip to content

(cli): support hotswap for EventBus attributes #18831

@misterjoshua

Description

@misterjoshua

Description

I'd like hot-swapping to support attributes of AWS::Events::EventBus.

Use Case

I'm developing a Step Functions State Machine that puts events onto an event bus, but hot-swap falls back to full deployment when I make a change.

import { App, Stack } from 'aws-cdk-lib';
import * as aws_events from 'aws-cdk-lib/aws-events';
import * as aws_stepfunctions from 'aws-cdk-lib/aws-stepfunctions';
import * as aws_stepfunctions_tasks from 'aws-cdk-lib/aws-stepfunctions-tasks';

const app = new App();
const stack = new Stack(app, 'integ-my-stack');

const eventBus = new aws_events.EventBus(stack, 'EventBus');

const definition = new aws_stepfunctions_tasks.EventBridgePutEvents(stack, 'PutEvents', {
  entries: [{
    // eventBus requires a resource attribute reference
    eventBus,
    source: stack.stackName,
    detailType: 'test',
    detail: aws_stepfunctions.TaskInput.fromObject({
      // Try changing this value and hotswapping.
      some: 'test-value',
    }),
  }],
});

new aws_stepfunctions.StateMachine(stack, 'StateMachine', {
  definition,
});

image

Proposed Solution

I imagine that we'd need to use the SDK to describe the attributes of the event bus to get these values, but I'm not sure.

Other information

Diff when changing test-value to test-value2:

Stack integ-my-stack
Resources
[~] AWS::StepFunctions::StateMachine StateMachine StateMachine2E01A3A5 
 └─ [~] DefinitionString
     └─ [~] .Fn::Join:
         └─ @@ -5,7 +5,7 @@
            [ ] {
            [ ]   "Ref": "AWS::Partition"
            [ ] },
            [-] ":states:::events:putEvents\",\"Parameters\":{\"Entries\":[{\"Detail\":{\"some\":\"test-value\"},\"DetailType\":\"test\",\"EventBusName\":\"",
            [+] ":states:::events:putEvents\",\"Parameters\":{\"Entries\":[{\"Detail\":{\"some\":\"test-value2\"},\"DetailType\":\"test\",\"EventBusName\":\"",
            [ ] {
            [ ]   "Fn::GetAtt": [
            [ ]     "EventBus7B8748AA",

Done in 11.25s.

aws-cdk-lib version: 2.10.0
CLI version: 2.10.0

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.effort/smallSmall work item – less than a day of effortin-progressThis issue is being actively worked on.p1package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions