Skip to content

Commit 2ea7fa3

Browse files
committed
disable if word has 5 letters
1 parent 440abb9 commit 2ea7fa3

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

testdata/wordle/main.tf

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@ locals {
1515

1616
description = "Capital letters are an exact match, lowercase are letters that are out of place."
1717
alphabet = split("", "abcdefghijklmnopqrstuvwxyz")
18-
remaining = setsubtract(toset(local.alphabet), toset(module.check_one.unmatching))
18+
remove_letters = setunion(
19+
try(toset(module.check_one.unmatching), []),
20+
try(toset(module.check_two.unmatching), []),
21+
try(toset(module.check_three.unmatching), []),
22+
try(toset(module.check_four.unmatching), []),
23+
try(toset(module.check_five.unmatching), []),
24+
try(toset(module.check_six.unmatching), []),
25+
)
26+
27+
remaining = setsubtract(
28+
toset(local.alphabet),
29+
local.remove_letters
30+
)
1931
}
2032

2133
output "unmatched" {
@@ -41,6 +53,10 @@ data "coder_parameter" "one" {
4153
order = 11
4254
default = ""
4355

56+
form_type_metadata = jsonencode({
57+
disabled = length(data.coder_parameter.one.value) == 5
58+
})
59+
4460
validation {
4561
regex = local.validation.regex
4662
error = local.validation.error
@@ -63,6 +79,10 @@ data "coder_parameter" "two" {
6379
order = 12
6480
default = ""
6581

82+
form_type_metadata = jsonencode({
83+
disabled = length(data.coder_parameter.two.value) == 5
84+
})
85+
6686
validation {
6787
regex = local.validation.regex
6888
error = local.validation.error
@@ -92,6 +112,10 @@ data "coder_parameter" "three" {
92112
order = 13
93113
default = ""
94114

115+
form_type_metadata = jsonencode({
116+
disabled = length(data.coder_parameter.three.value) == 5
117+
})
118+
95119
validation {
96120
regex = local.validation.regex
97121
error = local.validation.error
@@ -114,6 +138,10 @@ data "coder_parameter" "four" {
114138
order = 14
115139
default = ""
116140

141+
form_type_metadata = jsonencode({
142+
disabled = length(data.coder_parameter.four.value) == 5
143+
})
144+
117145
validation {
118146
regex = local.validation.regex
119147
error = local.validation.error
@@ -136,6 +164,10 @@ data "coder_parameter" "five" {
136164
order = 15
137165
default = ""
138166

167+
form_type_metadata = jsonencode({
168+
disabled = length(data.coder_parameter.five.value) == 5
169+
})
170+
139171
validation {
140172
regex = local.validation.regex
141173
error = local.validation.error
@@ -158,12 +190,21 @@ data "coder_parameter" "six" {
158190
order = 16
159191
default = ""
160192

193+
form_type_metadata = jsonencode({
194+
disabled = length(data.coder_parameter.six.value) == 5
195+
})
196+
161197
validation {
162198
regex = local.validation.regex
163199
error = local.validation.error
164200
}
165201
}
166202

203+
module "check_six" {
204+
source = "./checker"
205+
correct = local.correct
206+
previous = data.coder_parameter.six[0].value
207+
}
167208

168209
#
169210
# module "word_one" {

0 commit comments

Comments
 (0)