[英]Cloudformation nested stack outputs in yaml
In my nested stacks I need to use output values and AWS::CloudFormation::Stack returns values as 在我的嵌套堆栈中,我需要使用输出值,AWS :: CloudFormation :: Stack返回值为
Fn::GetAtt Outputs.NestedStackOutputName Fn :: GetAtt Outputs.NestedStackOutputName
But yaml doesn't allow me to use 但是yaml不允许我使用
!GetAtt MyResourceName.Outputs.MyOutputName
as it tries to split them into 3 pieces instead of the 2 it requires. 因为它试图将它们分成3块而不是它需要的2块。
I also tried using 我也试过用
Value: "Fn::GetAtt": [ "MyResourceName", "Outputs.MyOutputName" ]
but then I get 但后来我明白了
mapping values are not allowed here
in "<string>", line 21, column 24:
Value: "Fn::GetAtt": [ "MyResourceName", "Outputs.MyOutputName" ]
So how am I supposed to use this? 那我该怎么用? Do I really have to switch to json for this?
我真的必须切换到json吗?
It worked for me using these 2 stacks: 它使用这两个堆栈对我有用:
root.yml
: root.yml
:
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyNestedStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: https://s3.amazonaws.com/spg-test-bucket/cloudformation/nested.yml?versionId=HqlgDnuntMzkmK0398GPdJRUXMN_PMdn
RootBucket:
Type: AWS::S3::Bucket
Properties:
LoggingConfiguration:
DestinationBucketName:
Fn::GetAtt: [MyNestedStack, Outputs.NestedBucket]
nested.yml
: nested.yml
:
AWSTemplateFormatVersion: '2010-09-09'
Resources:
DataBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: LogDeliveryWrite
Outputs:
NestedBucket:
Value:
Ref: DataBucket
Your issue is due to a known bug in aws-cli
's custom YAML-parsing code that was added recently as part of the aws cloudformation deploy
and aws cloudformation package
commands. 您的问题是由于
aws-cli
的自定义YAML解析代码中的已知错误 ,该代码最近作为aws cloudformation deploy
和aws cloudformation package
命令的一部分添加。
The issue was fixed in version 1.11.37 of aws-cli
. 该问题已在
aws-cli
1.11.37版本中修复 。 To fix the issue, you can do either of the following: 要解决此问题,您可以执行以下任一操作:
aws-cli
to version 1.11.37 or greater. aws-cli
升级到1.11.37或更高版本。 aws cloudformation [create|update]-stack
to create/update your stack instead of aws cloudformation [package|deploy]
, if you're not making use of local artifacts. aws cloudformation [create|update]-stack
来创建/更新堆栈而不是aws cloudformation [package|deploy]
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.