aws-cloudformation / aws-cloudformation/cloudformation-template-schema
Schema is invalid, and outdated.
- Dominant language
- Java
- Stars
- 146
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
Validing https://s3.us-west-2.amazonaws.com/amazon-eks/cloudformation/2020-10-29/amazon-eks-vpc-private-subnets.yaml, while using https://s3.amazonaws.com/cfn-resource-specifications-us-east-1-prod/schemas/2.15.0/all-spec.json, I encountered one hard schema error.
In all-spec.json,
```
"FnOr" : {
"type" : "object",
"properties" : {
"description" : "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-or",
"Fn::Or" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/Condition"
},
"minItems" : 2,
"maxItems" : 10
}
},
"additionalProperties" : false
}
```
Is invalid, description might be in wrong place and should be a sibling of "type" : "array"? Schema refuse to load due to this bug. As of now it says description must be either object or boolean.
After working around this, this sea of validation errors were detected:
```
[{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property DependsOn is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 97,
"startColumn": 5,
"endLineNumber": 97,
"endColumn": 14
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property DependsOn is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 105,
"startColumn": 5,
"endLineNumber": 105,
"endColumn": 14
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property DependsOn is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 115,
"startColumn": 5,
"endLineNumber": 115,
"endColumn": 14
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property DependsOn is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 125,
"startColumn": 5,
"endLineNumber": 125,
"endColumn": 14
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property DependsOn is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 138,
"startColumn": 5,
"endLineNumber": 138,
"endColumn": 14
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property DependsOn is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 151,
"startColumn": 5,
"endLineNumber": 151,
"endColumn": 14
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property DependsOn is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 158,
"startColumn": 5,
"endLineNumber": 158,
"endColumn": 14
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property Metadata is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 166,
"startColumn": 5,
"endLineNumber": 166,
"endColumn": 13
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"array\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 173,
"startColumn": 11,
"endLineNumber": 175,
"endColumn": 1
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected one of string, object.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 183,
"startColumn": 16,
"endLineNumber": 183,
"endColumn": 17
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"string | FnBase64 | FnCidr | FnFindInMap | FnGetAtt | FnGetAZs | FnImportValue | FnJoin | object | FnSelect | FnSplit | FnSub\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 183,
"startColumn": 16,
"endLineNumber": 183,
"endColumn": 17
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property Metadata is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 187,
"startColumn": 5,
"endLineNumber": 187,
"endColumn": 13
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"array\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 194,
"startColumn": 11,
"endLineNumber": 196,
"endColumn": 1
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected one of string, object.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 204,
"startColumn": 16,
"endLineNumber": 204,
"endColumn": 17
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"string | FnBase64 | FnCidr | FnFindInMap | FnGetAtt | FnGetAZs | FnImportValue | FnJoin | object | FnSelect | FnSplit | FnSub\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 204,
"startColumn": 16,
"endLineNumber": 204,
"endColumn": 17
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property Metadata is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 208,
"startColumn": 5,
"endLineNumber": 208,
"endColumn": 13
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"array\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 214,
"startColumn": 11,
"endLineNumber": 216,
"endColumn": 1
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected one of string, object.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 224,
"startColumn": 16,
"endLineNumber": 224,
"endColumn": 17
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"string | FnBase64 | FnCidr | FnFindInMap | FnGetAtt | FnGetAZs | FnImportValue | FnJoin | object | FnSelect | FnSplit | FnSub\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 224,
"startColumn": 16,
"endLineNumber": 224,
"endColumn": 17
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Property Metadata is not allowed.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 228,
"startColumn": 5,
"endLineNumber": 228,
"endColumn": 13
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"array\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 234,
"startColumn": 11,
"endLineNumber": 236,
"endColumn": 1
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected one of string, object.",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 244,
"startColumn": 16,
"endLineNumber": 244,
"endColumn": 17
},{
"resource": "/home/username/projects/ansible_aws_eks/playbooks/files/cloudformation/vpc_public_private_subnets-template.yaml",
"owner": "_generated_diagnostic_collection_name_#1",
"severity": 8,
"message": "Incorrect type. Expected \"string | FnBase64 | FnCidr | FnFindInMap | FnGetAtt | FnGetAZs | FnImportValue | FnJoin | object | FnSelect | FnSplit | FnSub\".",
"source": "yaml-schema: file:///home/username/projects/ansible_aws_eks/schemas/all-spec.json",
"startLineNumber": 244,
"startColumn": 16,
"endLineNumber": 244,
"endColumn": 17
}]
```
I'm assuming a cloudformation schema provided by Amazon should pass validation. That link is given in official AWS EKS documentation. It's possible that schema link is not recent, if there is a new link that will have an updated json spec, I'd really appreciate it.
Contributor guide
Research direction
Start by validating the referenced all-spec.json, especially the FnOr definition, against the CloudFormation condition-function documentation. Reproduce the remaining diagnostics with amazon-eks-vpc-private-subnets.yaml, including DependsOn, Metadata, and intrinsic-function types; done means the schema loads and correctly validates the documented EKS template constructs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, json, yaml
- Domain
- cloud, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100