CloudFormation error for substitution values

Helo,
I am trying to add a trigger to a lambda function as follows. But it is throwing error as follows

 undefined method `match' for {"Ref"=>"EventRuleName"}

I have already defined a lambda and event rule prior to the creating the permissions stack .
But while running the permission stack it errored out

cloudformation

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: ""

Parameters:
  LambdaFunctionName:
    Type: String
    Default: lambda-function1
  EventBridgeRuleRoleName:
    Type: String
    Default: EventBridgeRuleRole1
  EventRuleName:
    Type: String
    Default: EventBridgeRule1
  Env:
    Type: String
  AWSTenant:
    Type: String
  TeamTag:
    Type: String
    Default: team1

Resources:
  PermissionForEvent0ToInvokeLambda:
    Type: AWS::Lambda::Permission
    Properties:
      FunctionName: !Ref LambdaFunctionName
      Action: "lambda:InvokeFunction"
      Principal: "events.amazonaws.com"
      SourceArn:
        Fn::GetAtt:
          - !Ref EventRuleName
          - "Arn"

Leave a Comment