0

我有一个使用此模板定义的 API Gateway Rest Api 资源:

AWSTemplateFormatVersion: '2010-09-09'
Description: "Api gateway"
Resources:
  ApiGateway:
    Type: "AWS::ApiGateway::RestApi"
    Properties:
      BodyS3Location: "./openapi-spec.yaml"

并且openapi-spec.yaml (基于此示例)的内容是:

openapi: "3.0.2"
info:
  title: SampleApi
paths:
  /test:
    get:
      summary: Test
      responses:
        "200":
          description: Ok
      security:
        - UserPool: [ ]
      x-amazon-apigateway-integration:
        # ....

components:
  securitySchemes:
    UserPool:
      type: apiKey
      name: Authorization
      in: header
      x-amazon-apigateway-authtype: cognito_user_pools
      x-amazon-apigateway-authorizer:
        type: cognito_user_pools
        providerARNs:
          ### THIS VALUE ###
          - "arn:aws:cognito-idp:eu-west-1:123456789012:userpool/eu-west-1_abcd12345"

我希望能够在多个环境/帐户中部署这个模板,并且拥有这个硬编码的 providerARN 会限制这一点。所以我的问题是:

如何providerARNs动态传递字段的值?

如果无法做到这一点,那么是否有任何解决方法,这样我就不必在这里对 providerArns 进行硬编码?

注意:已经尝试使用阶段变量,但它们似乎在这里不起作用。

4

0 回答 0