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]`
r-heimann opened this issue · comments
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
What rain command is causing this?
We are using
rain deploy <Template> <Stackname> --config <Parameters> --termination-protection --yes
This is a weird one. There is no difference, as far as YAML is concerned, between those two.
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.
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.