W1001 Ref to resource 'InternetGateway' that may not be available when condition 'ProvisionStack' is False and when condition 'ProvisionVpc' is True at Resources/InternetGatewayAttachment/Properties/InternetGatewayId
Specifically, the purported hypothetical situation
when condition 'ProvisionStack' is False and when condition 'ProvisionVpc' is True
is impossible per the ProvisionVpc rule.
Expected behavior
The lint should pass, without having to duplicate ProvisionVpc rule logic in
the ProvisionVpc condition. E.g. while updating the condition to:
results in a successful lint, this situation requires duplicate definitions
just to satisfy the linter, thus reducing maintainability.
Moreover, since cfn-lint's static analysis is based off of conditions instead
of rules (presumably, based on the reproduction template), templates that pass
lints might not preserve the intended behavior if a cascaded condition is added
without an accompanying duplicate rule.
CloudFormation Lint Version
1.11.0
What operating system are you using?
Mac
pre-commit
Describe the bug
The reproduction template throws:
Specifically, the purported hypothetical situation
is impossible per the
ProvisionVpc
rule.Expected behavior
The lint should pass, without having to duplicate
ProvisionVpc
rule logic in theProvisionVpc
condition. E.g. while updating the condition to:results in a successful lint, this situation requires duplicate definitions just to satisfy the linter, thus reducing maintainability.
Moreover, since
cfn-lint
's static analysis is based off of conditions instead of rules (presumably, based on the reproduction template), templates that pass lints might not preserve the intended behavior if a cascaded condition is added without an accompanying duplicate rule.Reproduction template