In my nested stacks I need to use output values and AWS::CloudFormation::Stack returns values as
Fn::GetAtt Outputs.NestedStackOutputName
But yaml doesn't allow me to use
!GetAtt MyResourceName.Outputs.MyOutputName
as it tries to split them into 3 pieces instead of the 2 it requires.
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?
It worked for me using these 2 stacks:
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
:
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.
The issue was fixed in version 1.11.37 of aws-cli
. To fix the issue, you can do either of the following:
aws-cli
to version 1.11.37 or greater. 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.