Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(scheduler-alpha): Schedule description is not set #31269

Closed
1 task
Assignees
Labels
@aws-cdk/aws-scheduler Related to the AWS Scheduler service bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@WtfJoke
Copy link
Contributor

WtfJoke commented Aug 30, 2024

Describe the bug

If you specify a description on a schedule its not set in the created Scheduled Rule.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

I would have expected that the description of a schedule will be set.

Current Behavior

The schedule is created without description

Reproduction Steps

import { Schedule, ScheduleExpression} from "@aws-cdk/aws-scheduler-alpha";
import { StepFunctionsStartExecution } from "@aws-cdk/aws-scheduler-targets-alpha";

new Schedule(scope, "SomeSchedule", {
        description: `Some description`,
        schedule: ScheduleExpression.rate(Duration.days(7)),
        target: new StepFunctionsStartExecution(someSfn, {}),
});

Possible Solution

Set field description of CfnSchedule in Schedule here:

const resource = new CfnSchedule(this, 'Resource', {
name: this.physicalName,

Additional Information/Context

No response

CDK CLI Version

2.150.0

Framework Version

No response

Node.js Version

20.17.0

OS

windows 11

Language

TypeScript

Language Version

5.5.4

Other information

No response

@WtfJoke WtfJoke added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2024
@github-actions github-actions bot added the @aws-cdk/aws-scheduler Related to the AWS Scheduler service label Aug 30, 2024
@ashishdhingra ashishdhingra self-assigned this Aug 30, 2024
@ashishdhingra ashishdhingra added p2 investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2024
@ashishdhingra
Copy link
Contributor

Reproducible using code below:

import * as cdk from 'aws-cdk-lib';
import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as stepfunction from 'aws-cdk-lib/aws-stepfunctions';
import * as stepfunctiontasks from 'aws-cdk-lib/aws-stepfunctions-tasks';
import * as scheduler from '@aws-cdk/aws-scheduler-alpha';
import * as schedulertargets from '@aws-cdk/aws-scheduler-targets-alpha';

export class CdktestStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const helloFunction = new lambda.Function(this, 'MyLambdaFunction', {
      code: lambda.Code.fromInline(`
            exports.handler = (event, context, callback) => {
                callback(null, "Hello World!");
            };
        `),
      runtime: lambda.Runtime.NODEJS_18_X,
      handler: "index.handler",
      timeout: cdk.Duration.seconds(3)
    });
    const stateMachine = new stepfunction.StateMachine(this, 'MyStateMachine', {
      definition: new stepfunctiontasks.LambdaInvoke(this, "MyLambdaTask", {
        lambdaFunction: helloFunction
      }).next(new sfn.Succeed(this, "GreetedWorld"))
    });

    new scheduler.Schedule(this, "SomeSchedule", {
      description: `Some description`,
      schedule: scheduler.ScheduleExpression.rate(cdk.Duration.days(7)),
      target: new schedulertargets.StepFunctionsStartExecution(stateMachine, {}),
    });
  }
}

Running cdk synth generates following CFN template:

...
  SomeSchedule2B2B2075:
    Type: AWS::Scheduler::Schedule
    Properties:
      FlexibleTimeWindow:
        Mode: "OFF"
      ScheduleExpression: rate(7 days)
      ScheduleExpressionTimezone: Etc/UTC
      State: ENABLED
      Target:
        Arn:
          Ref: MyStateMachine6C968CA5
        RetryPolicy:
          MaximumEventAgeInSeconds: 86400
          MaximumRetryAttempts: 185
        RoleArn:
          Fn::GetAtt:
            - SchedulerRoleForTarget1441a743A31888
            - Arn
    Metadata:
      aws:cdk:path: CdktestStack/SomeSchedule/Resource
...

Description is not emitted for AWS::Scheduler::Schedule.

Looks like ScheduleProps.description is not used to set Description while creating CfnSchedule object here.

@ashishdhingra ashishdhingra added effort/small Small work item – less than a day of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Aug 30, 2024
@mergify mergify bot closed this as completed in #31276 Sep 1, 2024
@mergify mergify bot closed this as completed in a3332b6 Sep 1, 2024
Copy link

github-actions bot commented Sep 1, 2024

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

1 similar comment
Copy link

github-actions bot commented Sep 1, 2024

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2024
pahud pushed a commit to pahud/aws-cdk that referenced this issue Sep 9, 2024
…d to the resource. (aws#31276)

### Issue # (if applicable)

Closes aws#31269 .

### Reason for this change
The `description` property is not used in the `Schedule` class.
As a result, the value of the `description` property is not reflected to the resource.



### Description of changes
Modify to set the value of props to the `description` property.



### Description of how you validated changes
Add a unit test and an integ test.


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
xazhao pushed a commit to xazhao/aws-cdk that referenced this issue Sep 12, 2024
…d to the resource. (aws#31276)

### Issue # (if applicable)

Closes aws#31269 .

### Reason for this change
The `description` property is not used in the `Schedule` class.
As a result, the value of the `description` property is not reflected to the resource.



### Description of changes
Modify to set the value of props to the `description` property.



### Description of how you validated changes
Add a unit test and an integ test.


### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.