cloudformation-coverage-roadmap icon indicating copy to clipboard operation
cloudformation-coverage-roadmap copied to clipboard

Documentation for !Ref of an AWS::Events::Rule not fully documented

Open pplu opened this issue 3 years ago • 2 comments

Name of the resource

AWS::Events::Rule

Resource name

No response

Reference Link

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#aws-resource-events-rule-return-values

Details

In https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#aws-resource-events-rule-return-values, the return value for the !Ref of a Rule is

Ref returns event rule ID, such as mystack-ScheduledRule-ABCDEFGHIJK

I have seen that Rules return "busname|rulename" as the value of !Ref. I am actually using the return value of !Ref on an Event this to monitor the rule like this:

 BusInvocationErrors:
   Type: AWS::CloudWatch::Alarm
   Properties:
    ActionsEnabled: true
    AlarmDescription: !Sub 'FailedInvocations in ${AWS::StackName}'
    ComparisonOperator: GreaterThanThreshold
    Dimensions:
    - Name: EventBusName
      Value: !Select [ 0, !Split [ '|', !Ref Rule ] ]
    - Name: RuleName
      Value: !Select [ 1, !Split [ '|', !Ref Rule ] ]
    Period: 60
    EvaluationPeriods: 1
    MetricName: FailedInvocations
    Namespace: AWS/Events
    Statistic: Sum

I would suggest that the return value be correctly documented.

pplu avatar Mar 31 '22 22:03 pplu

8 months into having reported this, and it bit me again (didn't even remember reporting it). Is this going to get corrected?

pplu avatar Jan 11 '23 16:01 pplu

When the rule is in the default event bus of the same account, just the rule name is returned. Otherwise, eventbusname|rulename is returned to be able to differentiate between rules in different buses. This is an expected behaviour and we will update the docs.

aleklale-amazon avatar Nov 01 '25 23:11 aleklale-amazon