[英]Azure DevOps Cloudformation update stack fails using parameters file (##[error]ValidationError: Parameters: do not exist in the template)
I have an Azure DevOps build pipeline that uses the AWS CloudFormation update stack task.我有一个使用 AWS CloudFormation 更新堆栈任务的 Azure DevOps 构建管道。 The CF Template refers to parameters stored in a parameters file.
CF 模板是指存储在参数文件中的参数。 When deploying, the build fails as the task cannot find the parameters that I have referenced in my parameters file.
部署时,构建失败,因为任务找不到我在参数文件中引用的参数。
Eg The file itself:例如文件本身:
[
{
"ParameterKey": "EnvironmentParameter",
"ParameterValue": "dev"
},
{
"ParameterKey": "DBHost",
"ParameterValue": "xxxxxxxxx.amazonaws.com"
}
]
The task references my template parameters file:该任务引用了我的模板参数文件:
Here is the reference in the template itself:这是模板本身的参考:
"dbhostparameter" : {
"Type" : "AWS::SSM::Parameter",
"Properties" : {
"Name" : "/LCS/Database/host",
"Type" : "String",
"Value" : {
"Fn::Sub" : [
"${env}",
{
"env" : {
"Ref" : "DBHost"
}
}
]
},
And here is the failure output (which shows it successfully loads the template parameters file)这里是失败 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',
Was missing the Parameters section of the actual CF Template.缺少实际 CF 模板的参数部分。 Without this, there was no reference point for the parameters file, therefore, the deployment failed.
没有这个,参数文件就没有参考点,因此部署失败。
Based on the comments.根据评论。
The issue was missing Parameters section
section.问题是缺少
Parameters section
部分。
The solution was to add the section .解决方案是添加部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.