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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With