I thought you could do something like this for a state machine using SAM:
SM:
Type: AWS::Serverless::StateMachine
Properties:
Name: !Sub "${StageName}-State-Machine"
DefinitionUri: statemachine/dddd.asl.json
Events:
Schedule:
!If
- IsPrimaryRegion
-
Type: Schedule
Properties:
Description: Schedule to run the twilio number state machine
Enabled: !Ref ScheduleEnabled
Schedule: "rate(1 hour)"
-
Type: Schedule
Properties:
Description: Schedule to run the twilio number state machine
Enabled: !Ref ScheduleEnabled
Schedule: "rate(1 hour)"
But SAM validation fails for this. It also fails if I use State instead of Enabled in properties. Ultimately I want to have a way to set Enabled dynamically, using a parameter or any other way. But validation with State fails.
Also tried this:
Enabled: !If [IsPrimaryRegion, true, false]