Conversion of Fn::GetAtt from YML to JSON for short form syntax
davinod opened this issue · 1 comments
davinod commented
Fn::GetAtt requires two arguments as input, Resource and Attribute.
The following entry is a valid YML reference, provided in AWS Documentation:
S3SubBucket:
Type: "AWS::S3::Bucket"
Properties:
Tags:
-
Key: "MainBucket"
Value: !GetAtt S3Stack.Outputs.BucketName
When this YML block is converted to json via $ cfn-flip -y , although it converts to a valid JSON syntax, it adds a third argument which makes the Fn::GetAtt be invalid:
"S3SubBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"Tags": [
{
"Key": "MainBucket",
"Value": {
"Fn::GetAtt": [
"S3Stack",
"Outputs",
"BucketName"
]
}
}
]
}
}
The correct conversion should be:
"Fn::GetAtt": [
"S3Stack",
"Outputs.BucketName"
]
In order to prevent this bug from happening, the template needs to be implemented using full syntax instead of short form:
Fn::GetAtt: [ S3Stack, Outputs.BucketName ]
It is very likely that when the cfn-flip finds !GetAtt S3Stack.Outputs.BucketName
, it is simply using '.' as delimiter and breaking in multiple items.