簡體   English   中英

Azure DevOps Cloudformation 更新堆棧使用參數文件失敗(##[error]ValidationError: Parameters: do not exist in the template)

[英]Azure DevOps Cloudformation update stack fails using parameters file (##[error]ValidationError: Parameters: do not exist in the template)

我有一個使用 AWS CloudFormation 更新堆棧任務的 Azure DevOps 構建管道。 CF 模板是指存儲在參數文件中的參數。 部署時,構建失敗,因為任務找不到我在參數文件中引用的參數。

例如文件本身:

[
  {
    "ParameterKey": "EnvironmentParameter",
    "ParameterValue": "dev"
  },
  {
    "ParameterKey": "DBHost",
    "ParameterValue": "xxxxxxxxx.amazonaws.com"
  }
]

該任務引用了我的模板參數文件:

在此處輸入圖像描述

這是模板本身的參考:

"dbhostparameter"      : {
    "Type" : "AWS::SSM::Parameter",
    "Properties" : {
        "Name" : "/LCS/Database/host",
        "Type" : "String",
        "Value" : {
            "Fn::Sub" : [
                "${env}", 
                {
                    "env" : {
                        "Ref" : "DBHost"
                    }
                }
            ]
        },

這里是失敗 output (這表明它成功加載了模板參數文件)

2020-06-29T22:37:36.2709027Z Updating stack with template file d:\a\1\s\parameters\parameters.template
2020-06-29T22:37:36.2709794Z Loading template file from 'd:\a\1\s\parameters\parameters.template'
2020-06-29T22:37:36.2713615Z Loading template parameters file 'd:\a\1\s\parameters_ssm_dev.json'
2020-06-29T22:37:36.2715581Z Successfully loaded template parameters
2020-06-29T22:37:36.2716132Z Setting capability CAPABILITY_IAM for stack
2020-06-29T22:37:36.2716592Z Setting capability CAPABILITY_NAMED_IAM for stack
2020-06-29T22:37:36.4072822Z Stack update request failed with error: 'Parameters: [DBHost] do not exist in the template' { ValidationError: Parameters: [DBHost] do not exist in the template
2020-06-29T22:37:36.4074350Z     at constructor.extractError (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:87664)
2020-06-29T22:37:36.4077291Z     at constructor.callListeners (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:95965)
2020-06-29T22:37:36.4078548Z     at constructor.emit (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:95675)
2020-06-29T22:37:36.4079603Z     at constructor.emitEvent (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:167913)
2020-06-29T22:37:36.4080477Z     at constructor.e (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:163452)
2020-06-29T22:37:36.4083390Z     at r.runTo (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:169755)
2020-06-29T22:37:36.4084174Z     at d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:169961
2020-06-29T22:37:36.4086749Z     at constructor.<anonymous> (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:163722)
2020-06-29T22:37:36.4087643Z     at constructor.<anonymous> (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:167969)
2020-06-29T22:37:36.4088469Z     at constructor.callListeners (d:\a\_tasks\CloudFormationCreateOrUpdateStack_7ef7cdfa-aa45-42c5-93c8-d7603643dd99\1.7.0\CloudFormationCreateOrUpdateStack.js:2:96071)
2020-06-29T22:37:36.4089053Z   message: 'Parameters: [DBHost] do not exist in the template',
2020-06-29T22:37:36.4089378Z   code: 'ValidationError',

缺少實際 CF 模板的參數部分。 沒有這個,參數文件就沒有參考點,因此部署失敗。

根據評論。

問題是缺少Parameters section部分。

解決方案是添加部分

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM