aws-cloudformation / cloudformation-coverage-roadmap

The AWS CloudFormation Public Coverage Roadmap
https://aws.amazon.com/cloudformation/
Creative Commons Attribution Share Alike 4.0 International
1.1k stars 53 forks source link

AWS::Events::Rule - GetAtt for Rule Name #1949

Open rrhodes opened 4 months ago

rrhodes commented 4 months ago

Name of the resource

AWS::Events::Rule

Resource name

No response

Description

For AWS::Events::Rule, CloudFormation supports !Ref to return the Rule ID and !GetAtt to return the Rule Arn.

There are cases where the Rule's name is required. For example, CloudWatch metrics for AWS::Events::Rule use the rule name as a dimension. The name can be extracted from the Rule's ID, which takes format <source event bus name>|<rule name>. Given Rule MyEventBridgeRuleResource, we get the name like as follows:

!Select [1, !Split ['|', !Ref MyEventBridgeRuleResource]]

Whilst the above is a sufficient workaround for now, may GetAtt be extended to support name retrieval in addition to ARN?

!GetAtt MyEventBridgeRuleResource.Name