Skip to content

Commit 8a40ff1

Browse files
authored
Update schema customization docs (#3463)
1 parent 07705c0 commit 8a40ff1

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Diff for: docs/customize_specifications.md

+14-9
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,28 @@ The following example only allows the usage of all `EC2` resources, except for `
3030
```
3131

3232
#### Alter Resource/Parameter specifications
33-
The spec file overwrites values from the Regional spec files which give you the possible to alter the specifications for your own needs. A good example is making optional Parameters required.
33+
CloudFormation schemas can be patched to change the behavior of how a property works. This can be amazingly useful if you want to require certain properties or add extra validation to a property. You can create a patch by specifying `Patches` at the root, then the resource type you want to patch, followed by a list of patches in [json patch](https://jsonpatch.com/) format.
3434

3535
For example, to enforce tagging on an S3 bucket, the override file looks like this:
3636

3737
```json
3838
{
39-
"ResourceTypes": {
40-
"AWS::S3::Bucket": {
41-
"Properties": {
42-
"Tags": {
43-
"Required": true
44-
}
39+
"Patches": {
40+
"AWS::S3::Bucket": [
41+
{
42+
"op": "add",
43+
"path": "/required",
44+
"value": [
45+
"Tags"
46+
]
4547
}
46-
}
48+
]
4749
}
4850
}
4951
```
5052

5153
**WARNING**
52-
The file is checked for valid JSON syntax, but does not check the contents of the file before merging it into the Specifications. Be careful with your changes because it can possibly corrupt the Specifications and break the linting process.
54+
JSON patches will fail if they don't apply the schema. Schema structure can change without changing how customers use the resource type. These changes may result in your patch breaking the cfn-lint process.
55+
56+
**WARNING**
57+
You can patch the schemas so the result is a non properly structured schema. For instance if you patch `/required` to have a value of `{}` cfn-lint will crash many ways as it is expecting an array. We test the schemas on each release to validate their structure before doing a release. We do not test them after you apply your patches.

0 commit comments

Comments
 (0)