【问题标题】:Using Import and sub psudo function return error使用 Import 和 sub psudo 函数返回错误
【发布时间】:2018-06-29 06:41:27
【问题描述】:

我有以下 cloudformation 代码:

  usagePlan:
Type: AWS::ApiGateway::UsagePlan
Properties:
  ApiStages:
  - ApiId: !ImportValue: "test-restApi-lambda-send-email-contactus-post"
    Stage: "stg1"
  Description: Customer ABC's usage plan
  Quota:
    Limit: 5000
    Period: MONTH
  Throttle:
    BurstLimit: 200
    RateLimit: 100
  UsagePlanName: Plan_ABC

一切都很好,代码正在运行。 只要我把它转到:

  usagePlan:
Type: AWS::ApiGateway::UsagePlan
Properties:
  ApiStages:
  - ApiId:
    Fn::ImportValue: !Sub "${project}-restApi-lambda-send-email-contactus-post"
    Stage: "stg1"
  Description: Customer ABC's usage plan
  Quota:
    Limit: 5000
    Period: MONTH
  Throttle:
    BurstLimit: 200
    RateLimit: 100
  UsagePlanName: Plan_ABC

我收到以下错误:

An error occurred (ValidationError) when calling the CreateStack operation: [/Resources/usagePlan/Type/ApiStages/0/ApiId] 'null' values are not allowed in templates

问题恰好发生在这个阶段:

Fn::ImportValue: !Sub "${project}-restApi-lambda-send-email-contactus-post"

有什么想法吗?这是aws中的错误吗?

【问题讨论】:

    标签: amazon-web-services aws-api-gateway amazon-cloudformation


    【解决方案1】:

    您在Fn::ImportValue 之前缺少一个标签:

    这应该可行:

    ApiStages:
      - ApiId:
          Fn::ImportValue: !Sub "${project}-restApi-lambda-send-email-contactus-post"
    

    【讨论】:

      猜你喜欢
      • 2023-03-21
      • 1970-01-01
      • 2015-09-03
      • 2016-03-10
      • 2023-03-22
      • 1970-01-01
      • 2014-07-24
      • 2021-12-13
      • 2021-05-10
      相关资源
      最近更新 更多