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

W8003 (Fn::Equals will always return true or false) doesn't validate if Fn::Equals will always return false #3846

Closed
Slooz opened this issue Nov 30, 2024 · 0 comments · Fixed by #3855

Comments

@Slooz
Copy link

Slooz commented Nov 30, 2024

CloudFormation Lint Version

1.20.1

What operating system are you using?

Mac

Describe the bug

The validation error message for W8003 is:

<Condition> will always return True or False

But W8003 will never output a validation error if a condition always evaluates to false. W8003 will only output a validation error if a condition always evaluates to true.

$ cfn-lint --format pretty --regions us-east-2 --include-checks I --configure-rule E3012:strict=True I3042:region=True I3042:accountId=True -- template.yaml

template.yaml
5:3:                W8003     ['true', 'true'] will always return True or False

Cfn-lint scanned 1 templates against 234 rules and found 0 errors, 1 warnings, and 0 informational violations

Expected behavior

W8003 should output a validation error if a condition always evaluates to false, or W8003 should be updated to indicate that it will only output a validation error if a condition always evaluates to true.

Reproduction template

%YAML 1.2
---
AWSTemplateFormatVersion: 2010-09-09
Conditions:
  AlwaysTrueCondition: !Equals
    - "true"
    - "true"
  AlwaysFalseCondition: !Equals
    - "true"
    - "false"
Resources:
  AlwaysCreatedResource:
    Type: AWS::S3::Bucket
    Condition: AlwaysTrueCondition
  NeverCreatedResource:
    Type: AWS::S3::Bucket
    Condition: AlwaysFalseCondition
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.

1 participant