1.6.1 error on !GettAtt of Outputs - was passing with 1.6.0
gidbalugo opened this issue · 6 comments
We recently failed on 1.6.1 update which produces error on !GetAtt
Outputs of AWS::CloudFormation::Stack. This was passing on before the update of 1.6.1
Sample template code causing failed results on 1.6.1 update but with passing build with 1.6.0
Error
Running cfn-lint on bootstrap.yaml
0 infos
0 warn
1 crit
Resource: Outputs > InfrastructurePipelineUrl > Value
Message: No such attribute Outputs.PipelineUrl on AWS::CloudFormation::Stack
Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html
Template invalid!
Exited with code 1
The template(s) resulting to error(bootstrap.yaml)
InfrastructurePipeline:
Type: AWS::CloudFormation::Stack
Properties:
// rest of code here
Outputs:
InfrastructurePipelineUrl:
Description: The continuous deployment pipeline in the AWS Management Console.
Value: !GetAtt InfrastructurePipeline.Outputs.PipelineUrl
The Outputs
part of source template.
Outputs:
PipelineUrl:
Value: !Sub https://console.aws.amazon.com/codepipeline/home?region=${AWS::Region}#/view/${Pipeline}
Thanks
Apparently, the issue does not occur prior to 1b867f1, perhaps @martysweet or @tomdionysus can help more...
FWIW, I've just tested with:
AWSTemplateFormatVersion: '2010-09-09'
Resources:
InfrastructurePipeline:
Type: "AWS::CloudFormation::Stack"
Properties:
TemplateURL: "https://s3.amazonaws.com/templates/myTemplate.template?versionId=123ab1cdeKdOW5IH4GAcYbEngcpTJTDW"
Outputs:
InfrastructurePipelineUrl:
Description: The continuous deployment pipeline in the AWS Management Console.
Value: !GetAtt InfrastructurePipeline.Outputs.PipelineUrl
This was caused by #139 (@tomdionysus) - Attributes are now checked and then assigned. I should have thought of more edge cases this could have affected.
As we don't know the outputs to a CFN::Stack this is an edge case which was missed.
Unfortantly the AWS::CloudFormation::Stack resource from AWS Spec doesn't mention anything about its Attributes or potential attributes.
"AWS::CloudFormation::Stack": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html",
"Properties": {
The simple (and probably only) fix would be to add a bypass for this resource type, like in the following link. The CFN Spec doesn't give enough information to say there might be custom attributes for this type.
https://github.com/tomdionysus/cfn-lint/blob/master/src/validator.ts#L1084-L1087
else if "AWS::CloudFormation::Stack" then
return "fixed_string"
Making this type customisable is a future improvement, the above fix will resolve the issue for now.
I am happy to accept a patch for this (and test cases) and make a new release asap, if not I will fix and release this evening (GMT).
Thanks @RazzM13 for the quick fix.
@gidbalugo The fix should now be up in npm as version v1.6.2, please can you confirm everything is working again?
Sweet!! That fixed it.
Thanks @martysweet @RazzM13
Oops - cheers guys. My bad.
@tomdionysus No worries!