-
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
--override-spec not adding custom resource types #3889
Comments
Looking into this. The way that override spec was written is that it allowed you to patch existing resources without changing the specs/schemas. Since you are adding a resource type you could use the Schema file: {
"typeName": "OK::StandaloneTask",
"properties": {
"ServiceName": {
"type": "string"
}
},
"required": [
"ServiceName"
],
"type": "object",
"additionalProperties": false
} Then ➜ cfn-lint --registry-schemas local/issue/3889/schemas -- local/issue/3889/3889.yaml
➜ echo $?
0
The schemas parameter will look for files inside a folder so just created a folder with the schema file in it. |
Thank you for your response, that approach works good for creating new resource types, would there be any way to define additional resources that are implicitly created with that custom resource? (maybe at this point it's easier to work with the processed template, although it would lose traceability of original line numbers for example) for example AWSTemplateFormatVersion: 2010-09-09
Transform: OKMacros
Resources:
MyStandaloneTask:
Type: OK::StandaloneTask
Properties:
ServiceName: "mystandalonetask"
Outputs:
# When transforming the template MyStandaloneTask also creates a RoleMyStandaloneTask resource
# that is of type AWS::IAM::Role
MyStandaloneTaskRoleArn:
Value: !Ref RoleMyStandaloneTask This gives the following output:
This is the simplified transformed template {
"AWSTemplateFormatVersion": "2010-09-09",
"Outputs": {
"MyStandaloneTaskRoleArn": {
"Value": {
"Ref": "RoleMyStandaloneTask"
}
}
},
"Resources": {
"RoleMyStandaloneTask": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {},
"RoleName": {},
"Policies": [],
"Tags": []
}
}
}
} |
CloudFormation Lint Version
1.22.2
What operating system are you using?
Mac
Describe the bug
I'm trying to upgrade from cfn-lint
0.87.x
to1.x
For adding compatibility with custom macro resources I'm trying to provide custom specs for rules like
E3006
via the--override-spec
command. This is really useful as we use custom resources via macro and we currently integrate cfn-lint 0.x with our CI pipelines successfully as of today.Here's a simple spec file for cfn-lint to recognize a custom
OK::StandaloneTask
resource, following the same syntax as StatefulResources.json. The docs say that specs should merge with the region-specific ones.In cfn-lint
0.87.11
the spec file was read and no errors were given, the template was successfully validated:However, in cfn-lint
1.22.2
the same command gives the following errorThis leads me to think there is a syntax change in spec definitions between 0.x and 1.x versions that I am not aware of?
Expected behavior
When passing an overriden spec, those specs should be used by cfn-lint.
Reproduction template
Spec file:
The text was updated successfully, but these errors were encountered: