File tree Expand file tree Collapse file tree 5 files changed +99
-0
lines changed
src/rpdk/guard_rail/rule_library/tags Expand file tree Collapse file tree 5 files changed +99
-0
lines changed Original file line number Diff line number Diff line change 47
47
| | ` TAG009 ` | ` "Resource MUST provide 'cloudFormationSystemTags' {true\|false} if 'tagging.taggable' is true" ` |
48
48
| | ` TAG010 ` | ` "Resource MUST provide 'tagProperty' {/properties/Tags} if 'tagging.taggable' is true" ` |
49
49
| | ` TAG011 ` | ` "Resource MUST implement Tags property if 'tagging.taggable' is true" ` |
50
+ | | ` TAG013 ` | ` "'tagProperty' MUST specify property defined in the schema" ` |
51
+ | | ` TAG014 ` | ` "'tagProperty' MUST NOT be a part of 'writeOnlyProperties'" ` |
50
52
51
53
#### Permissions
52
54
| Rule Name | Check Id | Message |
Original file line number Diff line number Diff line change @@ -112,6 +112,28 @@ rule ensure_property_tags_exists_v2 when tagging exists {
112
112
}
113
113
>>
114
114
115
+ when tagging.tagProperty exists {
116
+ let paths = paths
117
+ tagging.tagProperty IN %paths
118
+ <<
119
+ {
120
+ "result": "NON_COMPLIANT",
121
+ "check_id": "TAG013",
122
+ "message": "`tagProperty` MUST specify property defined in the schema"
123
+ }
124
+ >>
125
+
126
+ when writeOnlyProperties exists {
127
+ tagging.tagProperty !IN writeOnlyProperties
128
+ <<
129
+ {
130
+ "result": "NON_COMPLIANT",
131
+ "check_id": "TAG014",
132
+ "message": "`tagProperty` MUST NOT be a part of `writeOnlyProperties`"
133
+ }
134
+ >>
135
+ }
136
+ }
115
137
tagging.permission exists
116
138
<<
117
139
{
Original file line number Diff line number Diff line change
1
+ {
2
+ "properties" : {
3
+ "Tags" : {},
4
+ "Arn" : {}
5
+ },
6
+ "tagging" : {
7
+ "taggable" : true ,
8
+ "tagOnCreate" : true ,
9
+ "tagUpdatable" : true ,
10
+ "cloudFormationSystemTags" : false ,
11
+ "tagProperty" : " /properties/Tags2"
12
+ }
13
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "properties" : {
3
+ "Tags" : {},
4
+ "Arn" : {}
5
+ },
6
+ "writeOnlyProperties" : [
7
+ " /properties/Tags"
8
+ ],
9
+ "tagging" : {
10
+ "taggable" : true ,
11
+ "tagOnCreate" : true ,
12
+ "tagUpdatable" : true ,
13
+ "cloudFormationSystemTags" : false ,
14
+ "tagProperty" : " /properties/Tags"
15
+ }
16
+ }
Original file line number Diff line number Diff line change 168
168
},
169
169
{},
170
170
),
171
+ (
172
+ collect_schemas (
173
+ schemas = [
174
+ "file:/"
175
+ + str (
176
+ Path (os .path .dirname (os .path .realpath (__file__ ))).joinpath (
177
+ "../data/schema-malformed-tag-property.json"
178
+ )
179
+ )
180
+ ]
181
+ ),
182
+ [],
183
+ {
184
+ "ensure_property_tags_exists_v2" : {
185
+ GuardRuleResult (
186
+ check_id = "TAG013" ,
187
+ message = "`tagProperty` MUST specify property defined in the schema" ,
188
+ path = "/tagging/tagProperty" ,
189
+ )
190
+ },
191
+ },
192
+ {},
193
+ ),
194
+ (
195
+ collect_schemas (
196
+ schemas = [
197
+ "file:/"
198
+ + str (
199
+ Path (os .path .dirname (os .path .realpath (__file__ ))).joinpath (
200
+ "../data/schema-tag-property-writeonly.json"
201
+ )
202
+ )
203
+ ]
204
+ ),
205
+ [],
206
+ {
207
+ "ensure_property_tags_exists_v2" : {
208
+ GuardRuleResult (
209
+ check_id = "TAG014" ,
210
+ message = "`tagProperty` MUST NOT be a part of `writeOnlyProperties`" ,
211
+ path = "/tagging/tagProperty" ,
212
+ )
213
+ },
214
+ },
215
+ {},
216
+ ),
171
217
(
172
218
collect_schemas (
173
219
schemas = [
You can’t perform that action at this time.
0 commit comments