-
Notifications
You must be signed in to change notification settings - Fork 597
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
Generic Match/Project/Validate pattern rule #2672
Generic Match/Project/Validate pattern rule #2672
Conversation
I think some of this makes sense. As we move to v1 and the registry provider schemas we are doing a lot more json schema validation as well. In that approach we are actually building template scenarios that remove conditions and focus on the actual values. We also modified how json schema validation works to handle the other intrinsic functions. Why I say all of this is we can also write rules by extending the schema validation and writing json schemas. I don't think all the linked scenarios will work with this approach. I haven't written a mechanism for people to write their own json schemas at this point and this will not work across resources. |
Surely will look into v1 preview. It is good to hear that these might be included in v1. I much agree the v1 change that it is way better to focus on
We have used cfn for quite some years and definitely met some workarounds, issues that we want be able to configure the linters to check, and ended up arbitrary script that just load the yaml and check that. Please take it lightly in case it had been considered, since I have not dive into details of v1. (A) Handling conditionMy main concern is with linter performance if repeatedly evaluating parameter combinations on the whole template, which can be a pretty large if number of conditions are more than handful. How condition can affect a template 1. By adding or removing resources It maybe possible to compute and aggregate (B) Static value inferenceThe current API seem to leave static value inference to rule implementation by In this issue I've specifically added "Projection" for these use case I can think of
(C) Static type inferencecfn-lint v0.7 will miss on mismatched !Ref / !GetAtt, for example, The susceptibility to human error, for this Arn case, is probably due to the fact that it is quite arbitrary for each resource type that Does !Ref return an ARN or logical name?: my guess is majority is for logical name, and substantial minority returns arn
Does !GetAtt X.Arn is available: most resources has, but one can always find exception When arn is required by some field not explicitly naming someArn
Generally the returns will fall into several types, being one of Some additional use cases (D: suggestion) a stage for simple string substitution to dynamic references from downloaded values:
|
c2fcaa1
to
e7f3397
Compare
@kftsehk merge conflict on this one. Do we still need this PR? |
@kddejong any rule to assign rule id? I think I only miss that here. The conflict can be solved. |
Need to rework this to handle it in v1 |
Issue #, if available:
Targeting the implementation of cross-checking, such as
#2296 #1059 #1439
Description of changes:
This is an attempt to make v0.x linter more capable of cross-validation that depends on multiple fields
Some thoughts not implemented
Validations
item should accept a string template with one%s
fn = (checked_value) => bool
needed, met a case need to check10 | 30 | divisible by 60
cannot be enforced even with regexBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.