amazon-web-services - Azure DevOps Cloudformation 更新堆栈使用参数文件失败(##[错误]ValidationError : Parameters: do not exist in the template)

标签 amazon-web-services azure-devops aws-cloudformation

我有一个使用 AWS CloudFormation 更新堆栈任务的 Azure DevOps 构建管道。 CF 模板是指存储在参数文件中的参数。部署时,构建失败,因为任务找不到我在参数文件中引用的参数。

例如文件本身:

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

该任务引用我的模板参数文件:

enter image description here

这是模板本身的引用:

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

这是失败输出(显示它成功加载模板参数文件)

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',

最佳答案

基于评论。

问题是缺少参数部分部分。

解决方案是添加该部分

关于amazon-web-services - Azure DevOps Cloudformation 更新堆栈使用参数文件失败(##[错误]ValidationError : Parameters: do not exist in the template),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62647840/

相关文章:

使用 SSL 的 PHP 到 MySQL Amazon RDS,确认 SSL

azure - 部署从 Visual Studio Online 构建服务器构建的移动服务(.Net 后端)文件

aws-lambda - AWS SAM : Creating/Exporting API Gateway resource and importing it in another stack

aws-cloudformation - 如何从 Lambda 函数连接到 serverless.yml 中 "Resources"下定义的 RDS?

amazon-web-services - 目标组上的实例运行状况不佳

amazon-web-services - 如何使用 terraform 在 AWS API 网关中添加 URL 查询字符串参数?

amazon-web-services - Lambda 的 ARN 名称是静态的还是会更改?

javascript - AWS - 一个必需的键没有被赋予值

xamarin.forms - Azure Devops 管道 - AndroidSigning 上缺少输入 APK

.net - Web 应用和函数应用的 Azure 全局应用程序设置