@intentius/chant-lexicon-terraform 0.124.45 → 0.124.48

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,63 @@
1
+ # The plan depth's recorded document (#4358): `../show-plan.json` is
2
+ # `terraform show -json` over a saved plan of this root. README.md next door
3
+ # is the recording log. `plan-read/` holds the same `terraform_data` blocks
4
+ # without the shell provider, for the tests that run a real binary offline.
5
+ terraform {
6
+ backend "local" {
7
+ path = "terraform.tfstate"
8
+ }
9
+
10
+ required_providers {
11
+ shell = {
12
+ source = "scottwinkler/shell"
13
+ version = "~> 1.7"
14
+ }
15
+ }
16
+ }
17
+
18
+ variable "generation" {
19
+ type = string
20
+ default = "1"
21
+ }
22
+
23
+ # A sensitive default, on purpose: the redaction tests need a known secret
24
+ # to look for. TF006 is right about it in a real root.
25
+ # chant-ignore-block: TF006
26
+ variable "token" {
27
+ type = string
28
+ default = "hunter2"
29
+ sensitive = true
30
+ }
31
+
32
+ # Drifts: the recording rewrites conf.json between apply and plan, so the
33
+ # refresh finds the object changed outside Terraform (`resource_drift`).
34
+ resource "shell_script" "conf" {
35
+ working_directory = path.module
36
+
37
+ lifecycle_commands {
38
+ create = "printf '{\"port\":\"8080\"}' > conf.json; cat conf.json"
39
+ read = "cat conf.json"
40
+ delete = "rm -f conf.json"
41
+ }
42
+ }
43
+
44
+ # Reads the drifted object, so the plan lists it in `relevant_attributes`.
45
+ resource "terraform_data" "reader" {
46
+ input = shell_script.conf.output["port"]
47
+ }
48
+
49
+ resource "terraform_data" "replaced" {
50
+ triggers_replace = var.generation
51
+ input = "stable"
52
+ }
53
+
54
+ resource "terraform_data" "updated" {
55
+ input = {
56
+ name = "app-${var.generation}"
57
+ token = var.token
58
+ }
59
+ }
60
+
61
+ resource "terraform_data" "downstream" {
62
+ input = terraform_data.replaced.id
63
+ }
@@ -0,0 +1 @@
1
+ generation = "2"
@@ -0,0 +1,11 @@
1
+ import type { ChantConfig } from "@intentius/chant/config";
2
+ import "@intentius/chant-lexicon-terraform";
3
+
4
+ export default {
5
+ lexicons: ["terraform"],
6
+ terraform: {
7
+ roots: {
8
+ net: { dir: "./net" },
9
+ },
10
+ },
11
+ } satisfies ChantConfig;
@@ -0,0 +1,73 @@
1
+ # One VPC, two subnets, three security groups, and the rules and instances
2
+ # that reference them, for `chant search` over a terraform.roots project
3
+ # (chant #4365, #4368). Lint-clean, so `chant graph --format ir` draws it and
4
+ # the tests can compare the two commands' node ids.
5
+
6
+ # Local state on purpose: nothing applies this fixture.
7
+ # chant-ignore-block: TF001
8
+ terraform {
9
+ required_version = ">= 1.6"
10
+
11
+ required_providers {
12
+ aws = {
13
+ source = "hashicorp/aws"
14
+ version = "~> 5.0"
15
+ }
16
+ }
17
+ }
18
+
19
+ resource "aws_vpc" "main" {
20
+ cidr_block = "10.0.0.0/16"
21
+ }
22
+
23
+ resource "aws_subnet" "a" {
24
+ vpc_id = aws_vpc.main.id
25
+ cidr_block = "10.0.1.0/24"
26
+ }
27
+
28
+ resource "aws_subnet" "b" {
29
+ vpc_id = aws_vpc.main.id
30
+ cidr_block = "10.0.2.0/24"
31
+ }
32
+
33
+ resource "aws_security_group" "web" {
34
+ vpc_id = aws_vpc.main.id
35
+
36
+ ingress {
37
+ protocol = "tcp"
38
+ from_port = 443
39
+ to_port = 443
40
+ cidr_blocks = ["10.0.0.0/16"]
41
+ }
42
+ }
43
+
44
+ resource "aws_security_group" "batch" {
45
+ vpc_id = aws_vpc.main.id
46
+ }
47
+
48
+ resource "aws_security_group" "db" {
49
+ vpc_id = aws_vpc.main.id
50
+ }
51
+
52
+ resource "aws_security_group_rule" "db_pg" {
53
+ type = "ingress"
54
+ security_group_id = aws_security_group.db.id
55
+ source_security_group_id = aws_security_group.web.id
56
+ protocol = "tcp"
57
+ from_port = 5432
58
+ to_port = 5432
59
+ }
60
+
61
+ resource "aws_instance" "web" {
62
+ ami = "ami-12345678"
63
+ instance_type = "t3.micro"
64
+ subnet_id = aws_subnet.a.id
65
+ vpc_security_group_ids = [aws_security_group.web.id]
66
+ }
67
+
68
+ resource "aws_instance" "db" {
69
+ ami = "ami-12345678"
70
+ instance_type = "t3.micro"
71
+ subnet_id = aws_subnet.b.id
72
+ vpc_security_group_ids = [aws_security_group.db.id]
73
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "chant-fixture-terraform-search-roots",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module"
6
+ }
@@ -0,0 +1,11 @@
1
+ import type { ChantConfig } from "@intentius/chant/config";
2
+ import "@intentius/chant-lexicon-terraform";
3
+
4
+ export default {
5
+ lexicons: ["terraform"],
6
+ terraform: {
7
+ roots: {
8
+ net: { dir: "./net" },
9
+ },
10
+ },
11
+ } satisfies ChantConfig;
@@ -0,0 +1,38 @@
1
+ # Sensitive variables with literal defaults, for the redaction tests (chant
2
+ # #4377). TF006 is suppressed on purpose: the defaults are the point.
3
+
4
+ # Local state on purpose: nothing applies this fixture.
5
+ # chant-ignore-block: TF001
6
+ terraform {
7
+ required_version = ">= 1.6"
8
+ }
9
+
10
+ # chant-ignore-block: TF006, TF007
11
+ variable "api_token" {
12
+ type = string
13
+ default = "tok-string-9f3a"
14
+ sensitive = true
15
+ }
16
+
17
+ # chant-ignore-block: TF006, TF007
18
+ variable "db_port" {
19
+ default = 5432917
20
+ sensitive = true
21
+ }
22
+
23
+ # chant-ignore-block: TF006, TF007
24
+ variable "creds" {
25
+ sensitive = true
26
+ default = {
27
+ user = "admin-map-77"
28
+ pass = "pw-map-c0ffee"
29
+ }
30
+ }
31
+
32
+ variable "region" {
33
+ default = "us-east-1"
34
+ }
35
+
36
+ resource "aws_vpc" "main" {
37
+ cidr_block = "10.0.0.0/16"
38
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "chant-fixture-terraform-sensitive-default",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module"
6
+ }