@intentius/chant-lexicon-terraform 0.124.45 → 0.124.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/__fixtures__/capabilities/chant.config.d.ts +26 -0
  2. package/dist/__fixtures__/capabilities/chant.config.d.ts.map +1 -0
  3. package/dist/__fixtures__/capabilities/chant.config.js +13 -0
  4. package/dist/__fixtures__/effective-topology/chant.config.d.ts +13 -0
  5. package/dist/__fixtures__/effective-topology/chant.config.d.ts.map +1 -0
  6. package/dist/__fixtures__/effective-topology/chant.config.js +9 -0
  7. package/dist/__fixtures__/kind-type/chant.config.d.ts +13 -0
  8. package/dist/__fixtures__/kind-type/chant.config.d.ts.map +1 -0
  9. package/dist/__fixtures__/kind-type/chant.config.js +9 -0
  10. package/dist/__fixtures__/search-roots/chant.config.d.ts +13 -0
  11. package/dist/__fixtures__/search-roots/chant.config.d.ts.map +1 -0
  12. package/dist/__fixtures__/search-roots/chant.config.js +9 -0
  13. package/dist/__fixtures__/sensitive-default/chant.config.d.ts +13 -0
  14. package/dist/__fixtures__/sensitive-default/chant.config.d.ts.map +1 -0
  15. package/dist/__fixtures__/sensitive-default/chant.config.js +9 -0
  16. package/dist/capabilities/adapter.d.ts +9 -0
  17. package/dist/capabilities/adapter.d.ts.map +1 -0
  18. package/dist/capabilities/adapter.js +25 -0
  19. package/dist/capabilities/mapping.json +166 -0
  20. package/dist/config.d.ts +52 -0
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +23 -0
  23. package/dist/describe-resources.d.ts +101 -8
  24. package/dist/describe-resources.d.ts.map +1 -1
  25. package/dist/describe-resources.js +395 -56
  26. package/dist/hcl/parse.d.ts +10 -0
  27. package/dist/hcl/parse.d.ts.map +1 -1
  28. package/dist/hcl/parse.js +20 -2
  29. package/dist/hcl/redact.d.ts +26 -0
  30. package/dist/hcl/redact.d.ts.map +1 -0
  31. package/dist/hcl/redact.js +228 -0
  32. package/dist/integrity.json +2 -2
  33. package/dist/manifest.json +1 -1
  34. package/dist/op/activities/terraform.d.ts +109 -4
  35. package/dist/op/activities/terraform.d.ts.map +1 -1
  36. package/dist/op/activities/terraform.js +148 -7
  37. package/dist/plan-observation.d.ts +153 -0
  38. package/dist/plan-observation.d.ts.map +1 -0
  39. package/dist/plan-observation.js +354 -0
  40. package/dist/plugin.d.ts.map +1 -1
  41. package/dist/plugin.js +2 -0
  42. package/package.json +2 -2
  43. package/src/__fixtures__/ACCEPTANCE.md +53 -1
  44. package/src/__fixtures__/capabilities/catalog/main.tf +105 -0
  45. package/src/__fixtures__/capabilities/chant.config.ts +15 -0
  46. package/src/__fixtures__/capabilities/findings/main.tf +225 -0
  47. package/src/__fixtures__/capabilities/ledger/main.tf +265 -0
  48. package/src/__fixtures__/capabilities/package.json +1 -0
  49. package/src/__fixtures__/effective-topology/chant.config.ts +11 -0
  50. package/src/__fixtures__/effective-topology/net/main.tf +176 -0
  51. package/src/__fixtures__/effective-topology/package.json +6 -0
  52. package/src/__fixtures__/kind-type/app/main.tf +35 -0
  53. package/src/__fixtures__/kind-type/chant.config.ts +11 -0
  54. package/src/__fixtures__/kind-type/package.json +6 -0
  55. package/src/__fixtures__/live-plan-depth/README.md +59 -0
  56. package/src/__fixtures__/live-plan-depth/live-plan.json +110 -0
  57. package/src/__fixtures__/live-plan-depth/show-plan-sensitive.json +1 -0
  58. package/src/__fixtures__/live-plan-depth/show-plan.json +1 -0
  59. package/src/__fixtures__/plan-read/main.tf +46 -0
  60. package/src/__fixtures__/plan-read/next.tfvars +1 -0
  61. package/src/__fixtures__/plan-read-drift/README.md +33 -0
  62. package/src/__fixtures__/plan-read-drift/main.tf +63 -0
  63. package/src/__fixtures__/plan-read-drift/next.tfvars +1 -0
  64. package/src/__fixtures__/search-roots/chant.config.ts +11 -0
  65. package/src/__fixtures__/search-roots/net/main.tf +73 -0
  66. package/src/__fixtures__/search-roots/package.json +6 -0
  67. package/src/__fixtures__/sensitive-default/chant.config.ts +11 -0
  68. package/src/__fixtures__/sensitive-default/net/main.tf +38 -0
  69. package/src/__fixtures__/sensitive-default/package.json +6 -0
  70. package/src/__fixtures__/show-plan.json +663 -0
  71. package/src/capabilities/adapter.ts +32 -0
  72. package/src/capabilities/mapping.json +166 -0
  73. package/src/capabilities-workspace.e2e.test.ts +251 -0
  74. package/src/capabilities.test.ts +264 -0
  75. package/src/config.ts +26 -0
  76. package/src/describe-resources.live-plan.test.ts +302 -0
  77. package/src/describe-resources.live-root-unchanged.test.ts +126 -0
  78. package/src/describe-resources.plan.test.ts +437 -0
  79. package/src/describe-resources.ts +445 -52
  80. package/src/effective-topology.test.ts +134 -0
  81. package/src/hcl/parse.ts +30 -2
  82. package/src/hcl/redact.ts +181 -0
  83. package/src/live-plan-depth.acceptance.e2e.test.ts +193 -0
  84. package/src/op/activities/terraform.test.ts +118 -1
  85. package/src/op/activities/terraform.ts +213 -9
  86. package/src/plan-observation.ts +428 -0
  87. package/src/plan-read.acceptance.test.ts +184 -0
  88. package/src/plugin.ts +2 -0
  89. package/src/redact-ir.e2e.test.ts +79 -0
  90. package/src/redact.test.ts +111 -0
  91. package/src/search-build-roots.test.ts +125 -0
  92. package/src/search-count.test.ts +144 -0
  93. package/src/search-kind-type.test.ts +136 -0
@@ -0,0 +1,663 @@
1
+ {
2
+ "format_version": "1.2",
3
+ "terraform_version": "1.15.8",
4
+ "variables": {
5
+ "generation": {
6
+ "value": "2"
7
+ },
8
+ "token": {
9
+ "value": "hunter2"
10
+ }
11
+ },
12
+ "planned_values": {
13
+ "root_module": {
14
+ "resources": [
15
+ {
16
+ "address": "shell_script.conf",
17
+ "mode": "managed",
18
+ "type": "shell_script",
19
+ "name": "conf",
20
+ "provider_name": "registry.terraform.io/scottwinkler/shell",
21
+ "schema_version": 0,
22
+ "values": {
23
+ "dirty": false,
24
+ "environment": null,
25
+ "interpreter": null,
26
+ "lifecycle_commands": [
27
+ {
28
+ "create": "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json",
29
+ "delete": "rm -f conf.json",
30
+ "read": "cat conf.json",
31
+ "update": null
32
+ }
33
+ ],
34
+ "read_error": null,
35
+ "sensitive_environment": null,
36
+ "triggers": null,
37
+ "working_directory": "."
38
+ },
39
+ "sensitive_values": {
40
+ "lifecycle_commands": [
41
+ {}
42
+ ],
43
+ "output": {}
44
+ }
45
+ },
46
+ {
47
+ "address": "terraform_data.downstream",
48
+ "mode": "managed",
49
+ "type": "terraform_data",
50
+ "name": "downstream",
51
+ "provider_name": "terraform.io/builtin/terraform",
52
+ "schema_version": 0,
53
+ "values": {
54
+ "id": "cdc15f05-7729-5b45-9939-ac130870af9b",
55
+ "triggers_replace": null
56
+ },
57
+ "sensitive_values": {}
58
+ },
59
+ {
60
+ "address": "terraform_data.reader",
61
+ "mode": "managed",
62
+ "type": "terraform_data",
63
+ "name": "reader",
64
+ "provider_name": "terraform.io/builtin/terraform",
65
+ "schema_version": 0,
66
+ "values": {
67
+ "id": "ddeb5161-f76f-084c-c29d-ad91f80f695d",
68
+ "triggers_replace": null
69
+ },
70
+ "sensitive_values": {}
71
+ },
72
+ {
73
+ "address": "terraform_data.replaced",
74
+ "mode": "managed",
75
+ "type": "terraform_data",
76
+ "name": "replaced",
77
+ "provider_name": "terraform.io/builtin/terraform",
78
+ "schema_version": 0,
79
+ "values": {
80
+ "input": "stable",
81
+ "triggers_replace": "2"
82
+ },
83
+ "sensitive_values": {}
84
+ },
85
+ {
86
+ "address": "terraform_data.updated",
87
+ "mode": "managed",
88
+ "type": "terraform_data",
89
+ "name": "updated",
90
+ "provider_name": "terraform.io/builtin/terraform",
91
+ "schema_version": 0,
92
+ "values": {
93
+ "id": "102d392e-20a6-62b3-8e85-c4ddb3e78790",
94
+ "input": {
95
+ "name": "app-2",
96
+ "token": "hunter2"
97
+ },
98
+ "triggers_replace": null
99
+ },
100
+ "sensitive_values": {
101
+ "input": {
102
+ "token": true
103
+ },
104
+ "output": {}
105
+ }
106
+ }
107
+ ]
108
+ }
109
+ },
110
+ "resource_drift": [
111
+ {
112
+ "address": "shell_script.conf",
113
+ "mode": "managed",
114
+ "type": "shell_script",
115
+ "name": "conf",
116
+ "provider_name": "registry.terraform.io/scottwinkler/shell",
117
+ "change": {
118
+ "actions": [
119
+ "update"
120
+ ],
121
+ "before": {
122
+ "dirty": false,
123
+ "environment": null,
124
+ "id": "dbdq11g85ml2evuh7160",
125
+ "interpreter": null,
126
+ "lifecycle_commands": [
127
+ {
128
+ "create": "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json",
129
+ "delete": "rm -f conf.json",
130
+ "read": "cat conf.json",
131
+ "update": ""
132
+ }
133
+ ],
134
+ "output": {
135
+ "port": "8080"
136
+ },
137
+ "read_error": null,
138
+ "sensitive_environment": null,
139
+ "triggers": null,
140
+ "working_directory": "."
141
+ },
142
+ "after": {
143
+ "dirty": true,
144
+ "environment": null,
145
+ "id": "dbdq11g85ml2evuh7160",
146
+ "interpreter": null,
147
+ "lifecycle_commands": [
148
+ {
149
+ "create": "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json",
150
+ "delete": "rm -f conf.json",
151
+ "read": "cat conf.json",
152
+ "update": ""
153
+ }
154
+ ],
155
+ "output": {
156
+ "port": "8080"
157
+ },
158
+ "read_error": "",
159
+ "sensitive_environment": null,
160
+ "triggers": null,
161
+ "working_directory": "."
162
+ },
163
+ "after_unknown": {},
164
+ "before_sensitive": {
165
+ "lifecycle_commands": [
166
+ {}
167
+ ],
168
+ "output": {},
169
+ "sensitive_environment": true
170
+ },
171
+ "after_sensitive": {
172
+ "lifecycle_commands": [
173
+ {}
174
+ ],
175
+ "output": {},
176
+ "sensitive_environment": true
177
+ }
178
+ }
179
+ }
180
+ ],
181
+ "resource_changes": [
182
+ {
183
+ "address": "shell_script.conf",
184
+ "mode": "managed",
185
+ "type": "shell_script",
186
+ "name": "conf",
187
+ "provider_name": "registry.terraform.io/scottwinkler/shell",
188
+ "change": {
189
+ "actions": [
190
+ "delete",
191
+ "create"
192
+ ],
193
+ "before": {
194
+ "dirty": true,
195
+ "environment": null,
196
+ "id": "dbdq11g85ml2evuh7160",
197
+ "interpreter": null,
198
+ "lifecycle_commands": [
199
+ {
200
+ "create": "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json",
201
+ "delete": "rm -f conf.json",
202
+ "read": "cat conf.json",
203
+ "update": ""
204
+ }
205
+ ],
206
+ "output": {
207
+ "port": "8080"
208
+ },
209
+ "read_error": "",
210
+ "sensitive_environment": null,
211
+ "triggers": null,
212
+ "working_directory": "."
213
+ },
214
+ "after": {
215
+ "dirty": false,
216
+ "environment": null,
217
+ "interpreter": null,
218
+ "lifecycle_commands": [
219
+ {
220
+ "create": "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json",
221
+ "delete": "rm -f conf.json",
222
+ "read": "cat conf.json",
223
+ "update": null
224
+ }
225
+ ],
226
+ "read_error": null,
227
+ "sensitive_environment": null,
228
+ "triggers": null,
229
+ "working_directory": "."
230
+ },
231
+ "after_unknown": {
232
+ "id": true,
233
+ "lifecycle_commands": [
234
+ {}
235
+ ],
236
+ "output": true
237
+ },
238
+ "before_sensitive": {
239
+ "lifecycle_commands": [
240
+ {}
241
+ ],
242
+ "output": {},
243
+ "sensitive_environment": true
244
+ },
245
+ "after_sensitive": {
246
+ "lifecycle_commands": [
247
+ {}
248
+ ],
249
+ "output": {},
250
+ "sensitive_environment": true
251
+ },
252
+ "replace_paths": [
253
+ [
254
+ "dirty"
255
+ ]
256
+ ]
257
+ },
258
+ "action_reason": "replace_because_cannot_update"
259
+ },
260
+ {
261
+ "address": "terraform_data.downstream",
262
+ "mode": "managed",
263
+ "type": "terraform_data",
264
+ "name": "downstream",
265
+ "provider_name": "terraform.io/builtin/terraform",
266
+ "change": {
267
+ "actions": [
268
+ "update"
269
+ ],
270
+ "before": {
271
+ "id": "cdc15f05-7729-5b45-9939-ac130870af9b",
272
+ "input": "dd1202fc-a741-3635-905a-9e9633162183",
273
+ "output": "dd1202fc-a741-3635-905a-9e9633162183",
274
+ "triggers_replace": null
275
+ },
276
+ "after": {
277
+ "id": "cdc15f05-7729-5b45-9939-ac130870af9b",
278
+ "triggers_replace": null
279
+ },
280
+ "after_unknown": {
281
+ "input": true,
282
+ "output": true
283
+ },
284
+ "before_sensitive": {},
285
+ "after_sensitive": {}
286
+ }
287
+ },
288
+ {
289
+ "address": "terraform_data.reader",
290
+ "mode": "managed",
291
+ "type": "terraform_data",
292
+ "name": "reader",
293
+ "provider_name": "terraform.io/builtin/terraform",
294
+ "change": {
295
+ "actions": [
296
+ "update"
297
+ ],
298
+ "before": {
299
+ "id": "ddeb5161-f76f-084c-c29d-ad91f80f695d",
300
+ "input": "8080",
301
+ "output": "8080",
302
+ "triggers_replace": null
303
+ },
304
+ "after": {
305
+ "id": "ddeb5161-f76f-084c-c29d-ad91f80f695d",
306
+ "triggers_replace": null
307
+ },
308
+ "after_unknown": {
309
+ "input": true,
310
+ "output": true
311
+ },
312
+ "before_sensitive": {},
313
+ "after_sensitive": {}
314
+ }
315
+ },
316
+ {
317
+ "address": "terraform_data.replaced",
318
+ "mode": "managed",
319
+ "type": "terraform_data",
320
+ "name": "replaced",
321
+ "provider_name": "terraform.io/builtin/terraform",
322
+ "change": {
323
+ "actions": [
324
+ "delete",
325
+ "create"
326
+ ],
327
+ "before": {
328
+ "id": "dd1202fc-a741-3635-905a-9e9633162183",
329
+ "input": "stable",
330
+ "output": "stable",
331
+ "triggers_replace": "1"
332
+ },
333
+ "after": {
334
+ "input": "stable",
335
+ "triggers_replace": "2"
336
+ },
337
+ "after_unknown": {
338
+ "id": true,
339
+ "output": true
340
+ },
341
+ "before_sensitive": {},
342
+ "after_sensitive": {},
343
+ "replace_paths": [
344
+ [
345
+ "triggers_replace"
346
+ ]
347
+ ]
348
+ },
349
+ "action_reason": "replace_because_cannot_update"
350
+ },
351
+ {
352
+ "address": "terraform_data.updated",
353
+ "mode": "managed",
354
+ "type": "terraform_data",
355
+ "name": "updated",
356
+ "provider_name": "terraform.io/builtin/terraform",
357
+ "change": {
358
+ "actions": [
359
+ "update"
360
+ ],
361
+ "before": {
362
+ "id": "102d392e-20a6-62b3-8e85-c4ddb3e78790",
363
+ "input": {
364
+ "name": "app-1",
365
+ "token": "hunter2"
366
+ },
367
+ "output": {
368
+ "name": "app-1",
369
+ "token": "hunter2"
370
+ },
371
+ "triggers_replace": null
372
+ },
373
+ "after": {
374
+ "id": "102d392e-20a6-62b3-8e85-c4ddb3e78790",
375
+ "input": {
376
+ "name": "app-2",
377
+ "token": "hunter2"
378
+ },
379
+ "triggers_replace": null
380
+ },
381
+ "after_unknown": {
382
+ "input": {},
383
+ "output": true
384
+ },
385
+ "before_sensitive": {
386
+ "input": {
387
+ "token": true
388
+ },
389
+ "output": {}
390
+ },
391
+ "after_sensitive": {
392
+ "input": {
393
+ "token": true
394
+ },
395
+ "output": {}
396
+ }
397
+ }
398
+ }
399
+ ],
400
+ "prior_state": {
401
+ "format_version": "1.0",
402
+ "terraform_version": "1.15.8",
403
+ "values": {
404
+ "root_module": {
405
+ "resources": [
406
+ {
407
+ "address": "shell_script.conf",
408
+ "mode": "managed",
409
+ "type": "shell_script",
410
+ "name": "conf",
411
+ "provider_name": "registry.terraform.io/scottwinkler/shell",
412
+ "schema_version": 0,
413
+ "values": {
414
+ "dirty": true,
415
+ "environment": null,
416
+ "id": "dbdq11g85ml2evuh7160",
417
+ "interpreter": null,
418
+ "lifecycle_commands": [
419
+ {
420
+ "create": "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json",
421
+ "delete": "rm -f conf.json",
422
+ "read": "cat conf.json",
423
+ "update": ""
424
+ }
425
+ ],
426
+ "output": {
427
+ "port": "8080"
428
+ },
429
+ "read_error": "",
430
+ "sensitive_environment": null,
431
+ "triggers": null,
432
+ "working_directory": "."
433
+ },
434
+ "sensitive_values": {
435
+ "lifecycle_commands": [
436
+ {}
437
+ ],
438
+ "output": {},
439
+ "sensitive_environment": true
440
+ }
441
+ },
442
+ {
443
+ "address": "terraform_data.downstream",
444
+ "mode": "managed",
445
+ "type": "terraform_data",
446
+ "name": "downstream",
447
+ "provider_name": "terraform.io/builtin/terraform",
448
+ "schema_version": 0,
449
+ "values": {
450
+ "id": "cdc15f05-7729-5b45-9939-ac130870af9b",
451
+ "input": "dd1202fc-a741-3635-905a-9e9633162183",
452
+ "output": "dd1202fc-a741-3635-905a-9e9633162183",
453
+ "triggers_replace": null
454
+ },
455
+ "sensitive_values": {},
456
+ "depends_on": [
457
+ "terraform_data.replaced"
458
+ ]
459
+ },
460
+ {
461
+ "address": "terraform_data.reader",
462
+ "mode": "managed",
463
+ "type": "terraform_data",
464
+ "name": "reader",
465
+ "provider_name": "terraform.io/builtin/terraform",
466
+ "schema_version": 0,
467
+ "values": {
468
+ "id": "ddeb5161-f76f-084c-c29d-ad91f80f695d",
469
+ "input": "8080",
470
+ "output": "8080",
471
+ "triggers_replace": null
472
+ },
473
+ "sensitive_values": {},
474
+ "depends_on": [
475
+ "shell_script.conf"
476
+ ]
477
+ },
478
+ {
479
+ "address": "terraform_data.replaced",
480
+ "mode": "managed",
481
+ "type": "terraform_data",
482
+ "name": "replaced",
483
+ "provider_name": "terraform.io/builtin/terraform",
484
+ "schema_version": 0,
485
+ "values": {
486
+ "id": "dd1202fc-a741-3635-905a-9e9633162183",
487
+ "input": "stable",
488
+ "output": "stable",
489
+ "triggers_replace": "1"
490
+ },
491
+ "sensitive_values": {}
492
+ },
493
+ {
494
+ "address": "terraform_data.updated",
495
+ "mode": "managed",
496
+ "type": "terraform_data",
497
+ "name": "updated",
498
+ "provider_name": "terraform.io/builtin/terraform",
499
+ "schema_version": 0,
500
+ "values": {
501
+ "id": "102d392e-20a6-62b3-8e85-c4ddb3e78790",
502
+ "input": {
503
+ "name": "app-1",
504
+ "token": "hunter2"
505
+ },
506
+ "output": {
507
+ "name": "app-1",
508
+ "token": "hunter2"
509
+ },
510
+ "triggers_replace": null
511
+ },
512
+ "sensitive_values": {
513
+ "input": {
514
+ "token": true
515
+ },
516
+ "output": {}
517
+ }
518
+ }
519
+ ]
520
+ }
521
+ }
522
+ },
523
+ "configuration": {
524
+ "provider_config": {
525
+ "shell": {
526
+ "name": "shell",
527
+ "full_name": "registry.terraform.io/scottwinkler/shell",
528
+ "version_constraint": "~> 1.7"
529
+ },
530
+ "terraform": {
531
+ "name": "terraform",
532
+ "full_name": "terraform.io/builtin/terraform"
533
+ }
534
+ },
535
+ "root_module": {
536
+ "resources": [
537
+ {
538
+ "address": "shell_script.conf",
539
+ "mode": "managed",
540
+ "type": "shell_script",
541
+ "name": "conf",
542
+ "provider_config_key": "shell",
543
+ "expressions": {
544
+ "lifecycle_commands": [
545
+ {
546
+ "create": {
547
+ "constant_value": "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json"
548
+ },
549
+ "delete": {
550
+ "constant_value": "rm -f conf.json"
551
+ },
552
+ "read": {
553
+ "constant_value": "cat conf.json"
554
+ }
555
+ }
556
+ ],
557
+ "working_directory": {
558
+ "references": [
559
+ "path.module"
560
+ ]
561
+ }
562
+ },
563
+ "schema_version": 0
564
+ },
565
+ {
566
+ "address": "terraform_data.downstream",
567
+ "mode": "managed",
568
+ "type": "terraform_data",
569
+ "name": "downstream",
570
+ "provider_config_key": "terraform",
571
+ "expressions": {
572
+ "input": {
573
+ "references": [
574
+ "terraform_data.replaced.id",
575
+ "terraform_data.replaced"
576
+ ]
577
+ }
578
+ },
579
+ "schema_version": 0
580
+ },
581
+ {
582
+ "address": "terraform_data.reader",
583
+ "mode": "managed",
584
+ "type": "terraform_data",
585
+ "name": "reader",
586
+ "provider_config_key": "terraform",
587
+ "expressions": {
588
+ "input": {
589
+ "references": [
590
+ "shell_script.conf.output[\"port\"]",
591
+ "shell_script.conf.output",
592
+ "shell_script.conf"
593
+ ]
594
+ }
595
+ },
596
+ "schema_version": 0
597
+ },
598
+ {
599
+ "address": "terraform_data.replaced",
600
+ "mode": "managed",
601
+ "type": "terraform_data",
602
+ "name": "replaced",
603
+ "provider_config_key": "terraform",
604
+ "expressions": {
605
+ "input": {
606
+ "constant_value": "stable"
607
+ },
608
+ "triggers_replace": {
609
+ "references": [
610
+ "var.generation"
611
+ ]
612
+ }
613
+ },
614
+ "schema_version": 0
615
+ },
616
+ {
617
+ "address": "terraform_data.updated",
618
+ "mode": "managed",
619
+ "type": "terraform_data",
620
+ "name": "updated",
621
+ "provider_config_key": "terraform",
622
+ "expressions": {
623
+ "input": {
624
+ "references": [
625
+ "var.generation",
626
+ "var.token"
627
+ ]
628
+ }
629
+ },
630
+ "schema_version": 0
631
+ }
632
+ ],
633
+ "variables": {
634
+ "generation": {
635
+ "default": "1"
636
+ },
637
+ "token": {
638
+ "default": "hunter2",
639
+ "sensitive": true
640
+ }
641
+ }
642
+ }
643
+ },
644
+ "relevant_attributes": [
645
+ {
646
+ "resource": "shell_script.conf",
647
+ "attribute": [
648
+ "output",
649
+ "port"
650
+ ]
651
+ },
652
+ {
653
+ "resource": "terraform_data.replaced",
654
+ "attribute": [
655
+ "id"
656
+ ]
657
+ }
658
+ ],
659
+ "timestamp": "2026-10-23T17:59:34Z",
660
+ "applyable": true,
661
+ "complete": true,
662
+ "errored": false
663
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The terraform lexicon's capability pack (#4375): its mapping onto the
3
+ * lexicon-neutral view, as data, and the one thing the mapping can't say as
4
+ * data, how to read a policy written as `jsonencode({...})`.
5
+ */
6
+ import type { CapabilityAdapter, CapabilityMapping, CapabilityPack } from "@intentius/chant/capabilities/view";
7
+ import mapping from "./mapping.json" with { type: "json" };
8
+ import { isUnknown, readJsonencode } from "../hcl/jsonencode";
9
+
10
+ /** Turn each value position `readJsonencode` couldn't read into its expression, as `${...}` text. */
11
+ function withExpressions(v: unknown): unknown {
12
+ if (isUnknown(v)) return v.source !== undefined ? `\${${v.source}}` : undefined;
13
+ if (Array.isArray(v)) return v.map(withExpressions);
14
+ if (v && typeof v === "object") {
15
+ return Object.fromEntries(Object.entries(v as Record<string, unknown>).map(([k, x]) => [k, withExpressions(x)]));
16
+ }
17
+ return v;
18
+ }
19
+
20
+ export const terraformCapabilityAdapter: CapabilityAdapter = {
21
+ readDocument(value: unknown): unknown {
22
+ // An inline_policy block carries the document in its `policy` argument.
23
+ const raw = value && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>).policy : value;
24
+ const read = readJsonencode(raw, { unknownLeaves: true });
25
+ return read.kind === "literal" ? withExpressions(read.value) : undefined;
26
+ },
27
+ };
28
+
29
+ export const terraformCapabilityPack: CapabilityPack = {
30
+ mapping: mapping as CapabilityMapping,
31
+ adapter: terraformCapabilityAdapter,
32
+ };