Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a rule to avoid non-strings in template outputs #3725

Closed
2 tasks
francipvb opened this issue Oct 1, 2024 · 4 comments · Fixed by #3731
Closed
2 tasks

Add a rule to avoid non-strings in template outputs #3725

francipvb opened this issue Oct 1, 2024 · 4 comments · Fixed by #3731

Comments

@francipvb
Copy link

Is this feature request related to a new rule or cfn-lint capabilities?

No response

Describe the feature you'd like to request

Recently I had an issue deploying to cloudformation and I found that the issue was an exported number value.

Therefore I suggest you to add a lint rule to check output values for references to numbered values (just for references to resource attributes).

Describe the solution you'd like

I assume the linter have access to the JSON schema definition and the solution should be a matter of reference solving and checking.

I think a check for the GetAtt function should be enough.

Additional context

I was trying to deploy a MemoryDB cluster and a sibling stack was referencing the cluster port. I'm using the CDK.

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • ⚠️ This feature might incur a breaking change
@kddejong
Copy link
Contributor

kddejong commented Oct 2, 2024

Agreed. Looking into this. I thought we had covered this but I need to clean some of the logic up. Turns out if you do Value: 1 that it works but if you do Value: !Gett Resource.NonStringProperty it will fail.

Its bringing up that this issue extends beyond just Output Value and also exists in Sub, Joins, etc.

@Dantemss
Copy link

@kddejong after this change, it's not clear to me how we're supposed to Output for example an RDS DBCluster's Port, which is a number.

Value: !GetAtt DBCluster.Port fails with E6101
Attempting to cast it with something like Value: !Sub ${DBCluster.Port} also fails with E6101

Unless that is something that changed very recently, CloudFormation used to happily accept Value: !GetAtt DBCluster.Port

@kddejong
Copy link
Contributor

kddejong commented Oct 17, 2024

@Dantemss and this is to a AWS::RDS::DBCluster? And are you using Endpoint.Port? or .Port? Resource docs

@Dantemss
Copy link

Dantemss commented Oct 17, 2024

@kddejong sorry, my mistake. Our case is actually an AWS::DocDB::DBCluster: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-docdb-dbcluster.html

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

Successfully merging a pull request may close this issue.

3 participants