Skip to content

Commit 55ef7ab

Browse files
committed
Add variable validation
1 parent 5679bce commit 55ef7ab

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

examples/5.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
variable testvar {
2+
type = object({
3+
nouns = list(string),
4+
adjectives = list(string),
5+
})
6+
7+
description = "A word pool from mad list"
8+
9+
validation {
10+
condition = length(var.testvar["nouns"]) >= 11
11+
error_message = "at least 11 nounds are needed"
12+
}
13+
}

grammars/tf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ patterns:
169169
0: { name: punctuation.declaration.block.end.tf }
170170
patterns:
171171
- include: "#comments"
172-
- match: '\b(type|default|description)(?:\s+)?(=)(?:\s+)?'
172+
- match: '\b(type|default|description|validation)(?:\s+)?(=)?(?:\s+)?'
173173
captures:
174174
1: { name: meta.keyword.$1.tf }
175175
2: { name: keyword.operator.assignment.tf }

0 commit comments

Comments
 (0)