Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

1.6.1 error on !GettAtt of Outputs - was passing with 1.6.0 #149

Closed
gidbalugo opened this issue Apr 26, 2018 · 6 comments
Closed

1.6.1 error on !GettAtt of Outputs - was passing with 1.6.0 #149

gidbalugo opened this issue Apr 26, 2018 · 6 comments

Comments

@gidbalugo
Copy link

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

@RazzM13
Copy link
Contributor

RazzM13 commented Apr 26, 2018

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

@martysweet
Copy link
Owner

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).

@martysweet martysweet added this to the v1.6.2 milestone Apr 26, 2018
martysweet pushed a commit that referenced this issue Apr 26, 2018
…d in Fn::GetAtt (#150)

Issue #149 - Allow AWS::CloudFormation::Stack to return custom attributes when used in Fn::GetAtt
@martysweet
Copy link
Owner

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?

@gidbalugo
Copy link
Author

Sweet!! That fixed it.

Thanks @martysweet @RazzM13

@tomdionysus
Copy link
Contributor

Oops - cheers guys. My bad.

@martysweet
Copy link
Owner

@tomdionysus No worries!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants