Skip to content

AWS::ApiGateway::Stage - Please correct the documentation as the DeploymentId attribute to mandatory. I.e. ( Required: No ) to (Required: Yes) #1960

@savkatta123

Description

@savkatta123

Name of the resource

AWS::ApiGateway::Stage

Resource name

No response

Reference Link

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-stage.html

Details

From the documentation, I see only the mandatory attribute is RestApiId (Required: Yes) which is given as required. So while deploying with below template

AWSTemplateFormatVersion: 2010-09-09
Parameters:
  StageName:
    Description: The environment name (e.g., dev, test, prod)
    Type: String

Resources:
  TestApi:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Description: API used for test endpoint
      Name: 'test'
      Description: 'test API'
      FailOnWarnings: 'true'
      EndpointConfiguration:
        Types:
          - REGIONAL


  APIStage:
    Type: 'AWS::ApiGateway::Stage'
    Properties:
      RestApiId: !Ref TestApi
      StageName: !Ref StageName
      Description: 'API Stage'

IT is throwing an error "DeploymentId cannot be empty" . But providing with DeploymentId attribute for AWS::ApiGateway::Stage resource type the stack got deployed with below snippet.

AWSTemplateFormatVersion: 2010-09-09
Parameters:
  StageName:
    Description: The environment name (e.g., dev, test, prod)
    Type: String

Resources:
  TestApi:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Description: API used for test endpoint
      Name: 'test'
      Description: 'test API'
      FailOnWarnings: 'true'
      EndpointConfiguration:
        Types:
          - REGIONAL
          
  TestResource:
    Type: 'AWS::ApiGateway::Resource'
    Properties:
      RestApiId: !Ref TestApi
      ParentId: !GetAtt 'TestApi.RootResourceId'
      PathPart: 'customer'    
      
      
  MockMethod:
    Type: 'AWS::ApiGateway::Method'
    Properties:
      RestApiId: !Ref TestApi
      ResourceId: !GetAtt 
        - TestApi
        - RootResourceId
      HttpMethod: GET
      AuthorizationType: NONE
      RequestParameters:
        method.request.header.myheader: false
      Integration:
        Type: MOCK
        RequestParameters: 
          integration.request.header.header1: method.request.header.myheader
        IntegrationResponses:
          - StatusCode: '200'
            ResponseParameters:
              method.response.header.header1: integration.response.header.header1
              method.response.header.header2: "'staticvalue'"
      MethodResponses:
        - StatusCode: '200'
          ResponseParameters:
            method.response.header.header1: true
            method.response.header.header2: true      

  Deployment:
    DependsOn: MockMethod
    Type: 'AWS::ApiGateway::Deployment'
    Properties:
      RestApiId: !Ref TestApi
      Description: My deployment          


  APIStage:
    Type: 'AWS::ApiGateway::Stage'
    Properties:
      RestApiId: !Ref TestApi
      StageName: !Ref StageName
      DeploymentId: !Ref Deployment
      Description: 'API Stage'

Please correct the documentation for AWS::ApiGateway::Stage resource type and change the DeploymentId attribute to mandatory. I.e. ( Required: No ) to (Required: Yes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoveragedocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions