I'm trying to enable/disable lambda scheduled event based on environment, and not having much luck. If the env is prod
, it should enable the schedule, and if it's dev
it should disable it. However, the schedule status doesn't obey the condition. It's currently enabled in dev, but the template doesn't disable it. If I set the Enabled
property to false
manually, the schedule status does change to disable. So not sure where I'm going wrong (or if what I'm trying to do is possible). Any help is greatly appreciated!
Parameters:
env:
Type: String
Conditions:
isProd:
!Equals [!Ref env, prod]
Resources:
func:
Type: AWS::Serverless::Function
Properties:
Events:
ScheduledEvent:
Type: Schedule
Properties:
Schedule: rate(5 minutes)
Enabled: !If [isProd, true, false]