-
Notifications
You must be signed in to change notification settings - Fork 614
Description
Description
The effort to go to v1 will be driven by the goal to convert from CloudFormation specs to CloudFormation resource provider schemas. This will be a large change for how cfn-lint works and will result in rules having to be updated and changed. This issue will also serve to communicate the migration efforts.
Details
The CloudFormation resource provider schema is based on JSON Schema draft-07 but has modifications to handle the CloudFormation service These schemas allow us to do more straight JSON schema validation against resource properties. There are modifications to the schema and how the JSON schema validators work to handle CloudFormation specific capabilities. We find it important to provide the functionality and features that cfn-lint has had in v0 including the ability to disable and configure rules. As a result we will integrate in JSON schema validation into cfn-lint and cfn-lint will provide the functionality to massage the schemas and handle CloudFormation specific capabilities. Additionally there are checks in cfn-lint (best practices, etc.) that cannot be written into JSON schema validation.
Rule changes
All rules that have been modified or where the logic will change:
- E1027 -
DynamicReferenceSecureString
- Depended onmatch_resource_sub_properties
. Was re-written to usematch
- E1010 -
GetAtt
- Used the specs for valid GetAtt values - E1022 -
Join
- Used the specs to determine the type of a GetAtt - E1019 -
Sub
- Used the specs to determine the type of a GetAtt - E1029 -
SubNeeded
- Used the specs to determine valid GetAtt values - E6003 -
Value
(Outputs) - Used the specs to determine the type of a GetAtt - W2031 -
AllowedPattern
(Parameters) - Replaced by JSON Schema validation logic - W2030 -
AllowedValue
(Parameters) - Replaced by JSON Schema validation logic - E3001 -
Configuration
(Resources) - Replaced by JSON Schema validation. Logic is outside of the registry - E3000 -
JsonSchema
(Resources) - Expanded to handle registry resource schemas. Parent rule for all JSON schema validation rules - E3031 -
AllowedPattern
(Resource/Properties) - Replaced by JSON Schema validation logic - E3030 -
AllowedValue
(Resource/Properties) - Replaced by JSON Schema validation logic - E2522 -
AtLeastOne
(Resource/Properties) - Deleted? - E3017 -
CfnSchema
(Resource/Properties) (New Rule) - New rule to extend JSON Schema validation to handle scenarios not covered by the registry schema - E2520 -
Exclusive
(Resource/Properties) - Deleted. Handled by if/then/else logic in JSON schema validation - E2521 -
Inclusive
(Resource/Properties) - Deleted. Handled by if/then/else logic in JSON schema validation - E3502 -
JsonSize
(Resource/Properties) - Deleted. Converted to string maxLength and minLength validation - E3037 -
ListDuplicates
(Resource/Properties) - Replaced by JSON Schema validation logic - I3037 -
ListDuplicatesAllowed
(Resource/Properties) - Replaced by JSON Schema validation logic - E3032 -
ListSize
(Resource/Properties) - Replaced by JSON Schema validation logic - E3034 -
NumberSize
(Resource/Properties) - Replaced by JSON Schema validation logic - E2523 -
OnlyOne
(Resource/Properties) - Replaced byoneOf
logic in JSON schema - E3002 -
Properties
(Resource/Properties) - Replaced byproperties
andadditionalProperties
in JSON schema - E3003 -
Required
(Resource/Properties) - Replaced byrequired
in JSON schema - E3017 -
RequiredBasedOnValue
(Resource/Properties) - Replaced by if/then/else logic usingcfnSchema
and JSON schema - E3033 -
StringSize
(Resource/Properties) - Replaced byminLength
andmaxLength
in JSON schema. May still need to add exceptions for dynamic references - E3018 -
UnwantedBasedOnValue
(Resource/Properties) - Replaced by if/then/else logic usingcfnSchema
and JSON schema - E3012 -
ValuePrimitiveType
(Resource/Properties) - Replaced bytype
in JSON schema - E3008 -
ValueRefGetAtt
(Resource/Properties) - WIP
Breaking changes
This will serve as a list of changes that will occur in the migration from v0 to v1
match_resource_sub_properties
will be deprecated. This function was based on the specs and is not easily converted into the resource provider schema approach
Issues
- Some resource schemas have
readOnlyProperties
that are still write-able. Since we are removing them for validation we need to know the list of exceptions - Packaging doesn't like linked files so they are dropped. Need a different approach to handling marking resources as cached
Action Items
- Convert custom or 3rd party registry schema validation to the new rule E3000
- Don't run property checks multiple times if the specs across regions are cached
- Convert enum values taken from boto
- Convert other manually created allowedvalues, patterns, etc.
- Write tests to validate JSON Schema docs and extensions
- Add in
AWS::CDK::Metadata
schema