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

BUG: Updating from 1.7.5 to 1.8.1 causes Properties validation failed for resource Schedule with message: [#/FlexibleTimeWindow/Mode: false is not a valid enum value] #319

Closed
r-heimann opened this issue Mar 18, 2024 · 6 comments · Fixed by #329

Comments

@r-heimann
Copy link

r-heimann commented Mar 18, 2024

Hi,

updated rain from v1.7.5 to v1.8.1, it now causes

Properties validation failed for resource Schedule with message:
[#/FlexibleTimeWindow/Mode: false is not a valid enum value]

Affected CloudFormation Resource: AWS::Scheduler::Schedule
Example:

  Schedule:
    Type: AWS::Scheduler::Schedule
    Properties:
      GroupName: !Ref ScheduleGroupName
      ScheduleExpression: "rate(5 minutes)"
      ScheduleExpressionTimezone: "Europe/Berlin"
      FlexibleTimeWindow:
        Mode: "OFF"
      State: "ENABLED"
      Target:
        Arn: !GetAtt LambdaFunction.Arn
        RoleArn: !GetAtt ScheduleRole.Arn

rain 1.8.1 artifact:

  Schedule:
    Type: AWS::Scheduler::Schedule
    Properties:
      FlexibleTimeWindow:
        Mode: OFF # <- This seems to be affected
      GroupName: !Ref ScheduleGroupName
      ScheduleExpression: rate(5 minutes)
      ScheduleExpressionTimezone: Europe/Berlin
      State: ENABLED
      Target:
        Arn: !GetAtt LambdaFunction.Arn
        RoleArn: !GetAtt ScheduleRole.Arn

rain 1.7.5 artifact:

  Schedule:
    Type: AWS::Scheduler::Schedule
    Properties:
      GroupName: !Ref ScheduleGroupName
      ScheduleExpression: rate(5 minutes)
      ScheduleExpressionTimezone: Europe/Berlin
      FlexibleTimeWindow:
        Mode: "OFF"
      State: ENABLED
      Target:
        Arn: !GetAtt LambdaFunction.Arn
        RoleArn: !GetAtt ScheduleRole.Arn

The Documentation is also unclear what exacly they want for values: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-scheduler-schedule-flexibletimewindow.html

Mode
Determines whether the schedule is invoked within a flexible time window. You must use quotation marks when you specify this value in your JSON or YAML template.

Allowed Values: "OFF" | "FLEXIBLE"

Required: Yes

Type: String

Allowed values: OFF | FLEXIBLE

Update requires: No interruption
@ericzbeard
Copy link
Contributor

What rain command is causing this?

@r-heimann
Copy link
Author

We are using

rain deploy <Template> <Stackname> --config <Parameters> --termination-protection --yes

@ericzbeard
Copy link
Contributor

This is a weird one. There is no difference, as far as YAML is concerned, between those two.

@ericzbeard
Copy link
Contributor

This commit might be what broke it. I had to change that to fix a different bug in the formatter, to keep the styling consistent.

@ericzbeard
Copy link
Contributor

ericzbeard commented Mar 18, 2024

The problem is that the schema uses what is essentially a reserved word in YAML, OFF means the node is a boolean, not a string.

    "FlexibleTimeWindowMode": {
      "type": "string",
      "description": "Determines whether the schedule is executed within a flexible time window.",
      "enum": [
        "OFF",
        "FLEXIBLE"
      ]
    },

It should have been modeled as "DISABLED" or something like that to avoid clashing with the boolean aliases.

I will likely need to hack the formatter so that in this one case, we output "OFF" instead of OFF.

@ericzbeard
Copy link
Contributor

go-yaml/yaml#214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants