You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constYamlGetAtt=/!GetAtt\s+([A-Za-z][A-Za-z0-9]*)/g;// Matches !GetAtt LogicalId.Attribute - YAML short form get attribute
217
190
constYamlGetAttArray=/!GetAtt\s+\[\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches !GetAtt [LogicalId, Attribute] - YAML short form get attribute with array syntax
218
191
constYamlFindInMap=/!FindInMap\s+\[\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches !FindInMap [MappingName, Key1, Key2] - YAML short form mapping lookup
219
-
constYamlSub=/!Sub\s+["']?([^"'\n]+)["']?/g;// Matches !Sub "template string" - YAML short form string substitution
192
+
constYamlIf=/!If\s+\[\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches !If [ConditionName, TrueValue, FalseValue] - YAML short form conditional
220
193
constYamlRefColon=/Ref:\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches Ref: LogicalId - YAML long form reference
221
194
constYamlGetAttColon=/Fn::GetAtt:\s*\[\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches Fn::GetAtt: [LogicalId, Attribute] - YAML long form get attribute
222
195
constYamlFindInMapColon=/Fn::FindInMap:\s*\[\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches Fn::FindInMap: [MappingName, Key1, Key2] - YAML long form mapping lookup
223
-
constYamlSubColon=/Fn::Sub:\s*["']?([^"'\n]+)["']?/g;// Matches Fn::Sub: "template string" - YAML long form string substitution
196
+
constYamlIfColon=/Fn::If:\s*\[\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches Fn::If: [ConditionName, TrueValue, FalseValue] - YAML long form conditional
224
197
constYamlCondition=/Condition:\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches Condition: ConditionName - resource condition property in YAML
225
-
constYamlSubVariables=/\$\{([A-Za-z][A-Za-z0-9:]*)\}/g;// Matches ${LogicalId} or ${AWS::Region} - variables in Fn::Sub templates
226
198
constYamlSingleDep=/DependsOn:\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches DependsOn: LogicalId - single resource dependency in YAML
227
199
constYamlInlineDeps=/DependsOn:\s*\[([^\]]+)]/g;// Matches DependsOn: [Id1, Id2] - inline array format in YAML
228
200
constYamlListItem=/-\s*([A-Za-z][A-Za-z0-9]*)/g;// Matches - LogicalId in YAML list format
229
201
constYamlInlineItemPattern=/([A-Za-z][A-Za-z0-9]*)/g;// Matches LogicalId within the inline array
230
202
203
+
// Shared pattern for ${} variables - used by both JSON and YAML
204
+
constSubVariables=/\$\{([A-Za-z][A-Za-z0-9]*)(?:[.:]|(?=\}))/g;// Matches ${LogicalId} or ${Resource.Attr} or ${AWS::Region} - captures first segment only
205
+
231
206
constValidLogicalId=/^[A-Za-z][A-Za-z0-9.]+$/;
232
207
233
208
// Validated these regex, they will fail fast with ?= lookahead
0 commit comments