title: CloudFormation: extraneous key [DependsOn] is not permitted
body: <p>Building a simple Hello World API using SAM(API Gateway + Lambda). I was told <code>DependsOn</code> is supposed to work with all resources.</p>
  <p>The APIs were configured as :</p>
  <pre><code>HelloWorldAPI:
      Type: AWS::Serverless::Api
      # Type: AWS::ApiGateway::RestApi
      Properties: 
        Name: HelloWorldApi
        StageName: !Ref StageName
  
    HelloWorldAPIResource:
      Type: AWS::ApiGateway::Resource
      Properties:
        RestApiId: !Ref HelloWorldAPI
        ParentId: !GetAtt HelloWorldAPI.RootResourceId
        PathPart: hello
  
    HelloWorldAPIMethod:
      Type: AWS::ApiGateway::Method
      Properties:
        AuthorizationType: NONE
        HttpMethod: GET
        ResourceId: !Ref HelloWorldAPIResource
        RestApiId: !Ref HelloWorldAPI
        Integration:
          Type: AWS_PROXY
          IntegrationHttpMethod: GET
          Uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HelloWorldFunction.Arn}/invocations
            # - Arn: !GetAtt HelloWorldFunction.Arn
  
    HelloWorldAPIDeployment:
      Type: AWS::ApiGateway::Deployment
      Properties:
        RestApiId: !Ref HelloWorldAPI
        StageName: !Ref StageName
        DependsOn:
          - HelloWorldAPIMethod
  </code></pre>
  <p>But I get the following errors during deployment:</p>
  <pre><code>CREATE_FAILED                                   AWS::ApiGateway::Deployment                     HelloWorldAPIDeployment                         Properties validation failed for resource     
                                                                                                                                                  HelloWorldAPIDeployment with message: #:      
                                                                                                                                                  extraneous key [DependsOn] is not permitted   
  CREATE_FAILED                                   AWS::ApiGateway::Resource                       HelloWorldAPIResource                           Resource creation cancelled                   
  CREATE_FAILED                                   AWS::ApiGateway::Deployment                     HelloWorldAPIDeployment5332c373d4               Resource handler returned message: &quot;The REST  
                                                                                                                                                  API doesn't contain any methods (Service:     
                                                                                                                                                  ApiGateway, Status Code: 400, Request ID:     
                                                                                                                                                  634b4de5-ead7-48f5-8075-ab55d7176189,         
                                                                                                                                                  Extended Request ID: null)&quot; (RequestToken:    
                                                                                                                                                  ef65a5fd-cdf4-fe14-2010-a513bca36aca,         
                                                                                                                                                  HandlerErrorCode: InvalidRequest)             
  </code></pre>
  <p>The explicitly defined <code>AWS::ApiGateway::Deployment</code> is unable to use <code>DependsOn</code>, while there is another <code>AWS::ApiGateway::Deployment</code> being created implicitly but unnecessarily which is being deployed before the method, which was the reason I defined one explicitly in the first place.</p>
  <p>Any help is appreciated.</p>