Skip to content

Allow to pass parameter value for 'Enabled' property in ScheduledEvent of 'AWS::Serverless::Function' #1329

Closed

Description

@jeswanthamazon

When you reference a parameter for 'Enabled' property in ScheduledEvent of 'AWS::Serverless::Function', it is not honoring the parameter value passed and setting the "State": "ENABLED" for Events::Rule in the processed template.

'Enabled' property in ScheduledEvent of 'AWS::Serverless::Function' currently only accepts 'true' or 'false' bool values hard-coded as string in template.

in the background when composing the processed template, 'AWS::Serverless-2016-10-31' transform sees:

Currently Serverless transform is not capable of reading the parameter value to set the 'State' of Event::Rule.

Please add support to parse the parameter value and set the 'State' property value to 'DISABLED' /'Enabled' accordingly.

Activity

  1. SydneyUni-Jim commented on Jan 4, 2020

    @SydneyUni-Jim

    This is related to #1360

  2. praneetap commented on Jan 8, 2020

    @praneetap
    Contributor

    Thanks for the issue report! We have passed this along to our product team for possible prioritization. Please +1 on the feature to help with prioritization.

  3. added
    stage/pm-review
    on Aug 7, 2020
  4. RichieRunner commented on Oct 9, 2020

    @RichieRunner

    It has been 10 months, when is this going to be fixed? Even Enabled: False doesn't even work anymore.

  5. jwalsh2me commented on Oct 12, 2020

    @jwalsh2me

    @jfuss is this still under review?

  6. RichieRunner commented on Nov 3, 2020

    @RichieRunner

    this is such a shame. you have a core feature broken, and nobody who's paid to work on it even cares.

  7. z0ph commented on Nov 24, 2020

    @z0ph

    Same issue here, lost a few hours on troubleshooting this...

  8. RichieRunner commented on Nov 27, 2020

    @RichieRunner

    Since it's abundantly clear now that AWS and the maintainers of this codebase are refusing to prioritize this to be a critical bug, what is everyone's recommendation for disabling the Enabled flag if you are building resources in NP?

    I am trying to achieve this kind of conditional logic:
    image

  9. z0ph commented on Nov 27, 2020

    @z0ph

    Since it's abundantly clear now that AWS and the maintainers of this codebase are refusing to prioritize this to be a critical bug, what is everyone's recommendation for disabling the Enabled flag if you are building resources in NP?

    I am trying to achieve this kind of conditional logic:
    image

    Same here, what do you think @RichieRunner if we switch to the standard CloudFormation template (not SAM), should it be fine?

  10. jwalsh2me commented on Nov 27, 2020

    @jwalsh2me
  11. awsjeffg commented on Nov 27, 2020

    @awsjeffg

    @RichieRunner @z0ph @jwalsh2me thanks for bumping this issue and discussing workarounds. I've just now added this to the backlog internally, and I apologize that we struggle with communicating status on issues like this where there are internal and external trackers involved.

    Is there a workaround people have found for this particular issue? I was hoping for some cases like this that SAM CLI's recent addition of environments would help, but I can see why it fails here.

  12. jewelsjacobs commented on Nov 29, 2020

    @jewelsjacobs

    A workaround would be much appreciated. I'm running into the same issue using the same Condition logic.

  13. z0ph commented on Nov 30, 2020

    @z0ph

    Hi there,

    Do you think we can apply similar logic to the parent lambda event source?

    image

    I don't know where we can set this up in SAM. Any clues ?

  14. jewelsjacobs commented on Dec 1, 2020

    @jewelsjacobs

    FWIW, I have a bash script function workaround. It will remove the lambda CloudWatch Event rule trigger and disable the rule itself for SAM rules with the default serverlessrepo*. names. It should be easy to add parameters / variables to.

    I can't find an AWS CLI way to just disable a CloudWatch Event in the Lambda so I remove it.

    https://gist.github.com/jewelsjacobs/2ea1b37dd4db5279d038111e77d9d813

  15. 7 remaining items

  16. forzagreen commented on May 31, 2021

    @forzagreen
    Contributor

    I could work around this by adding a separate resource for AWS::Events::Rule and excluded 'Events' property from AWS::Serverless::Function. Example template:-

    Thank you @nbrational for the workaround.

    I think you also have to grant Events the permission to invoke the lambda, using AWS::Lambda::Permission resource :

      HelloWorldFunctionLambdaPermission:
        Type: AWS::Lambda::Permission
        Properties:
          Action: lambda:InvokeFunction
          FunctionName: !GetAtt HelloWorldFunction.Arn
          Principal: events.amazonaws.com
          SourceArn: !GetAtt HelloWorldFunctionScheduledEvent.Arn
    
  17. RichieRunner commented on Dec 19, 2021

    @RichieRunner

    Closing in on the 2 year mark with still no fix from the SAM team on this 🎉

  18. jfalkenstein commented on Jan 10, 2022

    @jfalkenstein

    Could we please get some attention on this?

  19. jfuss commented on Jun 16, 2022

    @jfuss
    Contributor

    Hey all, I am moving through our backlog of PRs and this PR (#1666) was looking to address this.

    I am in the middle of updating it but realized a couple things, if you are using Intrinsic Functions as the value, this will break because SAM expects "true" or "false" while the underlying CFN resource uses "enabled" or "disabled".

    SAM's history with intrinsic functions are hit or miss. Mostly due to us needing to re-implement how CloudFormation handles these, as there is no library provided by CloudFormation. Instead of going down that path (which has a bunch of flaws/concerns), I am thinking about adding a new property that will be a passthrough to the underlying CloudFormation resource directly. This would require customers to change their templates but existing ones would behave the same and people running into issues (as described here) could be unblocked.

    Looking for some thoughts from the community on this.

  20. jwalsh2me commented on Jun 28, 2022

    @jwalsh2me

    I like the idea of a new property!

  21. added and removed
    stage/pm-review
    on Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions