title: Trying to create AWS Elasticsearch cluster using serverless. Ended up with Status Code: 409; Error Code: InvalidTypeException
body: <p>Following is a snippet from my <code>serverless.yml</code> file to create elasticsearch domain. If I comment <code>AccessPolicies</code> section, elasticsearch domain got created but it fails when I un-comment it. I want to give access to the resources of my AWS account to access elasticsearch service. Not sure what is wrong. When I explore in stackoverflow or google, I hit some results but are related to terraform.
  Note: I use <code>serverless-pseudo-parameters</code> to refer to variables in <code>serverless.yml</code>.</p>
  <pre><code>EventsElasticsearchDomain:
    Type: AWS::Elasticsearch::Domain
    Properties:
      ElasticsearchVersion: 7.4
      DomainName: testevents
      ElasticsearchClusterConfig:
        InstanceCount: 1
        InstanceType: m5.large.elasticsearch
        ZoneAwarenessEnabled: false
      EBSOptions: # its expected when we use m4 or m4 InstanceType
        EBSEnabled: true
        VolumeSize: 10
        VolumeType: gp2
      AccessPolicies:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              AWS: '#{AWS::AccountId}'
            Action: 'es:ESHttp*'
            Resource:
              - arn:aws:es:#{AWS::Region}:#{AWS::AccountId}:domain/testevents/*
  </code></pre>
  <p><strong>Error</strong>:</p>
  <pre><code>An error occurred: EventsElasticsearchDomain - Error setting policy:
    [{&quot;Version&quot;:&quot;2012-10-17T00:00:00.000Z&quot;,&quot;Statement&quot;:[{&quot;Action&quot;:&quot;es:ESHttp*&quot;,&quot;Resource&quot;:[&quot;arn:aws:es:REGION:ACCNUMBER:domain/testevents/*&quot;],&quot;Effect&quot;:&quot;Allow&quot;,&quot;Principal&quot;:{&quot;AWS&quot;:&quot;ACCNUMBER&quot;}}]}] 
  (Service: AWSElasticsearch; 
  Status Code: 409; Error Code: InvalidTypeException; Request ID: xxxxxxxxxxx).
  </code></pre>