{"action":"closed","issue":{"url":"https://api.github.com/repos/awslabs/cfn-python-lint/issues/445","repository_url":"https://api.github.com/repos/awslabs/cfn-python-lint","labels_url":"https://api.github.com/repos/awslabs/cfn-python-lint/issues/445/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/cfn-python-lint/issues/445/comments","events_url":"https://api.github.com/repos/awslabs/cfn-python-lint/issues/445/events","html_url":"https://github.com/awslabs/cfn-python-lint/issues/445","id":378019379,"node_id":"MDU6SXNzdWUzNzgwMTkzNzk=","number":445,"title":"Custom resource types can't be validated with --override-spec","user":{"login":"medmunds","id":639984,"node_id":"MDQ6VXNlcjYzOTk4NA==","avatar_url":"https://avatars0.githubusercontent.com/u/639984?v=4","gravatar_id":"","url":"https://api.github.com/users/medmunds","html_url":"https://github.com/medmunds","followers_url":"https://api.github.com/users/medmunds/followers","following_url":"https://api.github.com/users/medmunds/following{/other_user}","gists_url":"https://api.github.com/users/medmunds/gists{/gist_id}","starred_url":"https://api.github.com/users/medmunds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medmunds/subscriptions","organizations_url":"https://api.github.com/users/medmunds/orgs","repos_url":"https://api.github.com/users/medmunds/repos","events_url":"https://api.github.com/users/medmunds/events{/privacy}","received_events_url":"https://api.github.com/users/medmunds/received_events","type":"User","site_admin":false},"labels":[{"id":897505837,"node_id":"MDU6TGFiZWw4OTc1MDU4Mzc=","url":"https://api.github.com/repos/awslabs/cfn-python-lint/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-06T20:26:20Z","updated_at":"2018-11-07T14:46:41Z","closed_at":"2018-11-07T14:46:41Z","author_association":"NONE","body":"*cfn-lint version:* 0.8.3\r\n\r\n*Description of issue:* When using custom resource types and supplying an override spec for the custom type, no property validations seem to be performed.\r\n\r\nExample: specify a `Custom::Example` type with a required `ID` property and an optional Boolean `Enabled` property:\r\n\r\ntest.cf.yaml:\r\n```yaml\r\nResources:\r\n  GoodExample:\r\n    Type: Custom::Example\r\n    Properties:\r\n      ServiceToken: example.arn\r\n      ID: good\r\n      Enabled: true\r\n\r\n  BadExample:\r\n    Type: Custom::Example\r\n    Properties:\r\n      ServiceToken: example.arn\r\n      # Missing required prop `ID`\r\n      Enabled: [invalid, 'must be a boolean']\r\n      Wrong: 'this prop is not in the spec'\r\n```\r\n\r\nCustomExampleSpec.json:\r\n```json\r\n{\r\n  \"ResourceTypes\": {\r\n    \"Custom::Example\": {\r\n      \"Properties\": {\r\n        \"ServiceToken\": {\"PrimitiveType\": \"String\", \"Required\": true, \"UpdateType\": \"Immutable\"},\r\n        \"ID\": {\"PrimitiveType\": \"String\", \"Required\": true, \"UpdateType\": \"Immutable\"},\r\n        \"Enabled\": {\"PrimitiveType\": \"Boolean\", \"Required\": false, \"UpdateType\": \"Mutable\"}\r\n      }\r\n    }\r\n  },\r\n  \"ResourceSpecificationVersion\": \"2.11.0\"\r\n}\r\n```\r\n\r\nRun: `cfn-lint --override-spec CustomExampleSpec.json test.cf.yaml`\r\n\r\nResults: No lint errors or warnings\r\n\r\nExpected:\r\n```\r\nE3003 Property ID missing at Resources/BadExample/Properties\r\ntest.cf.yaml:11:5\r\n\r\nE3002 Property should be of type Boolean not List at Resources/BadExample/Properties/Enabled\r\ntest.cf.yaml:14:7\r\n\r\nE3002 Invalid Property Resources/BadExample/Properties/Wrong\r\ntest.cf.yaml:15:7\r\n```\r\n\r\nThis is occurring because #295 unconditionally forces any type starting with `Custom::` to `AWS::CloudFormation::CustomResource`, which deliberately allows all properties. For unknown custom types, that's incredibly useful. But if you have a known spec for the custom type, it would be good to use that instead.\r\n\r\nI think this can be accomplished by changing `if resourcetype.startswith('Custom::')` to add `... and not resourcetype in self.resourcetypes` in both [Properties.py](https://github.com/awslabs/cfn-python-lint/blob/v0.8.3/src/cfnlint/rules/resources/properties/Properties.py#L270) and [Required.py](https://github.com/awslabs/cfn-python-lint/blob/v0.8.3/src/cfnlint/rules/resources/properties/Required.py#L132).\r\n"}}
{"actor":{"display_login":"kddejong"}}