@intentius/chant-lexicon-terraform 0.124.52 → 0.124.55
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.
- package/README.md +14 -10
- package/dist/__fixtures__/pr-loop/estate.component.d.ts +7 -0
- package/dist/__fixtures__/pr-loop/estate.component.d.ts.map +1 -0
- package/dist/__fixtures__/pr-loop/estate.component.js +7 -0
- package/dist/__fixtures__/report/generate.d.ts +26 -0
- package/dist/__fixtures__/report/generate.d.ts.map +1 -0
- package/dist/__fixtures__/report/generate.js +58 -0
- package/dist/applied-state.d.ts +27 -0
- package/dist/applied-state.d.ts.map +1 -0
- package/dist/applied-state.js +44 -0
- package/dist/backend-config.d.ts +53 -0
- package/dist/backend-config.d.ts.map +1 -0
- package/dist/backend-config.js +136 -0
- package/dist/behaviour/kinds.d.ts.map +1 -1
- package/dist/behaviour/kinds.js +4 -0
- package/dist/behaviour/predict.d.ts.map +1 -1
- package/dist/behaviour/predict.js +6 -2
- package/dist/behaviour/reference-catalog.d.ts +16 -5
- package/dist/behaviour/reference-catalog.d.ts.map +1 -1
- package/dist/behaviour/reference-catalog.js +16 -5
- package/dist/behaviour/request.d.ts.map +1 -1
- package/dist/behaviour/request.js +3 -2
- package/dist/changed-roots.d.ts +6 -4
- package/dist/changed-roots.d.ts.map +1 -1
- package/dist/changed-roots.js +14 -18
- package/dist/ci-setup.d.ts +11 -0
- package/dist/ci-setup.d.ts.map +1 -0
- package/dist/ci-setup.js +41 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +4 -3
- package/dist/components/capability-plugin.d.ts +105 -9
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/components/capability-plugin.js +357 -36
- package/dist/components/compose-group.d.ts +145 -0
- package/dist/components/compose-group.d.ts.map +1 -0
- package/dist/components/compose-group.js +407 -0
- package/dist/components/placeholder-preview.d.ts +78 -0
- package/dist/components/placeholder-preview.d.ts.map +1 -0
- package/dist/components/placeholder-preview.js +254 -0
- package/dist/components/release-inputs.d.ts +29 -0
- package/dist/components/release-inputs.d.ts.map +1 -0
- package/dist/components/release-inputs.js +57 -0
- package/dist/components/trace-facts.d.ts +16 -0
- package/dist/components/trace-facts.d.ts.map +1 -0
- package/dist/components/trace-facts.js +19 -0
- package/dist/compose/apply-events.d.ts +46 -0
- package/dist/compose/apply-events.d.ts.map +1 -0
- package/dist/compose/apply-events.js +77 -0
- package/dist/compose/estate.d.ts +194 -0
- package/dist/compose/estate.d.ts.map +1 -0
- package/dist/compose/estate.js +363 -0
- package/dist/compose/hcl.d.ts +99 -0
- package/dist/compose/hcl.d.ts.map +1 -0
- package/dist/compose/hcl.js +302 -0
- package/dist/compose/module-address.d.ts +24 -0
- package/dist/compose/module-address.d.ts.map +1 -0
- package/dist/compose/module-address.js +43 -0
- package/dist/compose/root.d.ts +127 -0
- package/dist/compose/root.d.ts.map +1 -0
- package/dist/compose/root.js +586 -0
- package/dist/compose/run.d.ts +183 -0
- package/dist/compose/run.d.ts.map +1 -0
- package/dist/compose/run.js +447 -0
- package/dist/compose/slice.d.ts +102 -0
- package/dist/compose/slice.d.ts.map +1 -0
- package/dist/compose/slice.js +249 -0
- package/dist/compose/state-address.d.ts +28 -0
- package/dist/compose/state-address.d.ts.map +1 -0
- package/dist/compose/state-address.js +154 -0
- package/dist/compose/state-merge.d.ts +52 -0
- package/dist/compose/state-merge.d.ts.map +1 -0
- package/dist/compose/state-merge.js +135 -0
- package/dist/compose.d.ts +179 -0
- package/dist/compose.d.ts.map +1 -0
- package/dist/compose.js +482 -0
- package/dist/composites/terraform-apply-op.d.ts.map +1 -1
- package/dist/composites/terraform-apply-op.js +7 -3
- package/dist/cone.d.ts +53 -0
- package/dist/cone.d.ts.map +1 -0
- package/dist/cone.js +119 -0
- package/dist/config.d.ts +59 -13
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +43 -9
- package/dist/cost-hold.d.ts +27 -0
- package/dist/cost-hold.d.ts.map +1 -0
- package/dist/cost-hold.js +21 -0
- package/dist/describe-resources.d.ts +74 -12
- package/dist/describe-resources.d.ts.map +1 -1
- package/dist/describe-resources.js +374 -66
- package/dist/drift-read.d.ts +33 -0
- package/dist/drift-read.d.ts.map +1 -0
- package/dist/drift-read.js +243 -0
- package/dist/drift-record.d.ts +147 -0
- package/dist/drift-record.d.ts.map +1 -0
- package/dist/drift-record.js +383 -0
- package/dist/drift-rows.d.ts +61 -0
- package/dist/drift-rows.d.ts.map +1 -0
- package/dist/drift-rows.js +108 -0
- package/dist/exit-codes.d.ts +55 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +48 -0
- package/dist/hcl/edges.d.ts.map +1 -1
- package/dist/hcl/edges.js +24 -1
- package/dist/hcl/files.d.ts +61 -0
- package/dist/hcl/files.d.ts.map +1 -0
- package/dist/hcl/files.js +221 -0
- package/dist/hcl/instances.d.ts +82 -0
- package/dist/hcl/instances.d.ts.map +1 -0
- package/dist/hcl/instances.js +390 -0
- package/dist/hcl/parse.d.ts +81 -9
- package/dist/hcl/parse.d.ts.map +1 -1
- package/dist/hcl/parse.js +114 -16
- package/dist/hcl/roots.d.ts.map +1 -1
- package/dist/hcl/roots.js +5 -0
- package/dist/hcl/suppressions.d.ts.map +1 -1
- package/dist/hcl/suppressions.js +8 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -2
- package/dist/integrity.json +8 -5
- package/dist/lint/audit-catalog.d.ts.map +1 -1
- package/dist/lint/audit-catalog.js +27 -3
- package/dist/lint/audit-lineage.d.ts +14 -2
- package/dist/lint/audit-lineage.d.ts.map +1 -1
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/post-synth/index.js +4 -0
- package/dist/lint/post-synth/record-store.d.ts +54 -0
- package/dist/lint/post-synth/record-store.d.ts.map +1 -0
- package/dist/lint/post-synth/record-store.js +104 -0
- package/dist/lint/post-synth/tf001.d.ts +2 -2
- package/dist/lint/post-synth/tf001.js +2 -2
- package/dist/lint/post-synth/tf024.d.ts +35 -11
- package/dist/lint/post-synth/tf024.d.ts.map +1 -1
- package/dist/lint/post-synth/tf024.js +92 -20
- package/dist/lint/post-synth/tf046.d.ts +64 -0
- package/dist/lint/post-synth/tf046.d.ts.map +1 -0
- package/dist/lint/post-synth/tf046.js +175 -0
- package/dist/lint/post-synth/tf047.d.ts +36 -0
- package/dist/lint/post-synth/tf047.d.ts.map +1 -0
- package/dist/lint/post-synth/tf047.js +94 -0
- package/dist/live-plan-reasons.d.ts +21 -0
- package/dist/live-plan-reasons.d.ts.map +1 -0
- package/dist/live-plan-reasons.js +47 -0
- package/dist/lock-rows.d.ts +36 -0
- package/dist/lock-rows.d.ts.map +1 -0
- package/dist/lock-rows.js +60 -0
- package/dist/lock-timeout.d.ts +22 -0
- package/dist/lock-timeout.d.ts.map +1 -0
- package/dist/lock-timeout.js +32 -0
- package/dist/lsp/option-keys.d.ts.map +1 -1
- package/dist/lsp/option-keys.js +2 -0
- package/dist/manifest.json +1 -1
- package/dist/module-catalog/index.d.ts +69 -0
- package/dist/module-catalog/index.d.ts.map +1 -0
- package/dist/module-catalog/index.js +110 -0
- package/dist/module-catalog/refresh-cli.d.ts +4 -0
- package/dist/module-catalog/refresh-cli.d.ts.map +1 -0
- package/dist/module-catalog/refresh-cli.js +64 -0
- package/dist/module-catalog/static-tier.d.ts +6 -0
- package/dist/module-catalog/static-tier.d.ts.map +1 -0
- package/dist/module-catalog/static-tier.js +1650 -0
- package/dist/module-catalog/types.d.ts +65 -0
- package/dist/module-catalog/types.d.ts.map +1 -0
- package/dist/module-catalog/types.js +33 -0
- package/dist/okf/index.md +3 -1
- package/dist/okf/rules/TF024.md +2 -2
- package/dist/okf/rules/TF046.md +11 -0
- package/dist/okf/rules/TF047.md +11 -0
- package/dist/op/activities/index.d.ts +6 -2
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/index.js +5 -1
- package/dist/op/activities/live-detect.d.ts +4 -3
- package/dist/op/activities/live-detect.d.ts.map +1 -1
- package/dist/op/activities/live-detect.js +57 -32
- package/dist/op/activities/pin-rollout.d.ts +2 -0
- package/dist/op/activities/pin-rollout.d.ts.map +1 -1
- package/dist/op/activities/pin-rollout.js +1 -0
- package/dist/op/activities/terraform.d.ts +182 -5
- package/dist/op/activities/terraform.d.ts.map +1 -1
- package/dist/op/activities/terraform.js +224 -24
- package/dist/op/activity-contracts.d.ts +27 -0
- package/dist/op/activity-contracts.d.ts.map +1 -1
- package/dist/op/activity-contracts.js +19 -1
- package/dist/op/builders.d.ts +7 -1
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/builders.js +9 -0
- package/dist/pin/consumers.d.ts +35 -0
- package/dist/pin/consumers.d.ts.map +1 -0
- package/dist/pin/consumers.js +70 -0
- package/dist/pin/edit.d.ts.map +1 -1
- package/dist/pin/edit.js +35 -0
- package/dist/pin/rollout.d.ts +2 -0
- package/dist/pin/rollout.d.ts.map +1 -1
- package/dist/pin/rollout.js +14 -11
- package/dist/plan-shape.d.ts +30 -0
- package/dist/plan-shape.d.ts.map +1 -0
- package/dist/plan-shape.js +125 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +37 -18
- package/dist/registry/address.d.ts +63 -0
- package/dist/registry/address.d.ts.map +1 -0
- package/dist/registry/address.js +65 -0
- package/dist/registry/catalog-read.d.ts +14 -0
- package/dist/registry/catalog-read.d.ts.map +1 -0
- package/dist/registry/catalog-read.js +58 -0
- package/dist/registry/deprecated.d.ts +37 -0
- package/dist/registry/deprecated.d.ts.map +1 -0
- package/dist/registry/deprecated.js +43 -0
- package/dist/registry/docs.d.ts +96 -0
- package/dist/registry/docs.d.ts.map +1 -0
- package/dist/registry/docs.js +210 -0
- package/dist/registry/edge/edge.d.ts +46 -0
- package/dist/registry/edge/edge.d.ts.map +1 -0
- package/dist/registry/edge/edge.js +194 -0
- package/dist/registry/edge/index.d.ts +11 -0
- package/dist/registry/edge/index.d.ts.map +1 -0
- package/dist/registry/edge/index.js +10 -0
- package/dist/registry/edge/lambda-edge.d.ts +76 -0
- package/dist/registry/edge/lambda-edge.d.ts.map +1 -0
- package/dist/registry/edge/lambda-edge.js +95 -0
- package/dist/registry/edge/sigv4-web.d.ts +33 -0
- package/dist/registry/edge/sigv4-web.d.ts.map +1 -0
- package/dist/registry/edge/sigv4-web.js +56 -0
- package/dist/registry/edge/token-source.d.ts +73 -0
- package/dist/registry/edge/token-source.d.ts.map +1 -0
- package/dist/registry/edge/token-source.js +115 -0
- package/dist/registry/edge/worker.d.ts +45 -0
- package/dist/registry/edge/worker.d.ts.map +1 -0
- package/dist/registry/edge/worker.js +26 -0
- package/dist/registry/handler.d.ts +25 -0
- package/dist/registry/handler.d.ts.map +1 -0
- package/dist/registry/handler.js +75 -0
- package/dist/registry/headers-file.d.ts +21 -0
- package/dist/registry/headers-file.d.ts.map +1 -0
- package/dist/registry/headers-file.js +57 -0
- package/dist/registry/index.d.ts +31 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +30 -0
- package/dist/registry/mirror-paths.d.ts +9 -0
- package/dist/registry/mirror-paths.d.ts.map +1 -0
- package/dist/registry/mirror-paths.js +8 -0
- package/dist/registry/mirror.d.ts +130 -0
- package/dist/registry/mirror.d.ts.map +1 -0
- package/dist/registry/mirror.js +319 -0
- package/dist/registry/proxies.d.ts +73 -0
- package/dist/registry/proxies.d.ts.map +1 -0
- package/dist/registry/proxies.js +111 -0
- package/dist/registry/reader.d.ts +57 -0
- package/dist/registry/reader.d.ts.map +1 -0
- package/dist/registry/reader.js +198 -0
- package/dist/registry/semver.d.ts +16 -0
- package/dist/registry/semver.d.ts.map +1 -0
- package/dist/registry/semver.js +24 -0
- package/dist/registry/serve.d.ts +24 -0
- package/dist/registry/serve.d.ts.map +1 -0
- package/dist/registry/serve.js +64 -0
- package/dist/registry/source-forms.d.ts +79 -0
- package/dist/registry/source-forms.d.ts.map +1 -0
- package/dist/registry/source-forms.js +202 -0
- package/dist/registry/targets/artifactory.d.ts +28 -0
- package/dist/registry/targets/artifactory.d.ts.map +1 -0
- package/dist/registry/targets/artifactory.js +206 -0
- package/dist/registry/targets/fake-artifactory.d.ts +30 -0
- package/dist/registry/targets/fake-artifactory.d.ts.map +1 -0
- package/dist/registry/targets/fake-artifactory.js +142 -0
- package/dist/registry/targets/fake-gitlab.d.ts +39 -0
- package/dist/registry/targets/fake-gitlab.d.ts.map +1 -0
- package/dist/registry/targets/fake-gitlab.js +136 -0
- package/dist/registry/targets/fake-hcp.d.ts +50 -0
- package/dist/registry/targets/fake-hcp.d.ts.map +1 -0
- package/dist/registry/targets/fake-hcp.js +202 -0
- package/dist/registry/targets/fake-http.d.ts +31 -0
- package/dist/registry/targets/fake-http.d.ts.map +1 -0
- package/dist/registry/targets/fake-http.js +87 -0
- package/dist/registry/targets/fake-nexus.d.ts +27 -0
- package/dist/registry/targets/fake-nexus.d.ts.map +1 -0
- package/dist/registry/targets/fake-nexus.js +137 -0
- package/dist/registry/targets/gitlab.d.ts +53 -0
- package/dist/registry/targets/gitlab.d.ts.map +1 -0
- package/dist/registry/targets/gitlab.js +187 -0
- package/dist/registry/targets/hcp.d.ts +29 -0
- package/dist/registry/targets/hcp.d.ts.map +1 -0
- package/dist/registry/targets/hcp.js +310 -0
- package/dist/registry/targets/hosted.d.ts +62 -0
- package/dist/registry/targets/hosted.d.ts.map +1 -0
- package/dist/registry/targets/hosted.js +74 -0
- package/dist/registry/targets/index.d.ts +18 -0
- package/dist/registry/targets/index.d.ts.map +1 -0
- package/dist/registry/targets/index.js +17 -0
- package/dist/registry/targets/module-target.d.ts +68 -0
- package/dist/registry/targets/module-target.d.ts.map +1 -0
- package/dist/registry/targets/module-target.js +63 -0
- package/dist/registry/targets/nexus.d.ts +43 -0
- package/dist/registry/targets/nexus.d.ts.map +1 -0
- package/dist/registry/targets/nexus.js +250 -0
- package/dist/registry/targets/zip.d.ts +55 -0
- package/dist/registry/targets/zip.d.ts.map +1 -0
- package/dist/registry/targets/zip.js +278 -0
- package/dist/registry/writer.d.ts +101 -0
- package/dist/registry/writer.d.ts.map +1 -0
- package/dist/registry/writer.js +109 -0
- package/dist/report.d.ts +15 -6
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +28 -55
- package/dist/rules/record-store.ts +122 -0
- package/dist/rules/tf001.ts +2 -2
- package/dist/rules/tf024.ts +105 -22
- package/dist/rules/tf046.ts +204 -0
- package/dist/rules/tf047.ts +114 -0
- package/dist/skills/chant-terraform.md +1 -1
- package/dist/state/azure-blob.d.ts +9 -0
- package/dist/state/azure-blob.d.ts.map +1 -0
- package/dist/state/azure-blob.js +8 -0
- package/dist/state/backend.d.ts +158 -0
- package/dist/state/backend.d.ts.map +1 -0
- package/dist/state/backend.js +406 -0
- package/dist/state/exec.d.ts +39 -0
- package/dist/state/exec.d.ts.map +1 -0
- package/dist/state/exec.js +80 -0
- package/dist/state/gcs.d.ts +8 -0
- package/dist/state/gcs.d.ts.map +1 -0
- package/dist/state/gcs.js +7 -0
- package/dist/state/index.d.ts +15 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +14 -0
- package/dist/state/locks.d.ts +105 -0
- package/dist/state/locks.d.ts.map +1 -0
- package/dist/state/locks.js +130 -0
- package/dist/state/object-store.d.ts +8 -0
- package/dist/state/object-store.d.ts.map +1 -0
- package/dist/state/object-store.js +7 -0
- package/dist/state/root-states.d.ts +131 -0
- package/dist/state/root-states.d.ts.map +1 -0
- package/dist/state/root-states.js +241 -0
- package/dist/state/s3.d.ts +21 -0
- package/dist/state/s3.d.ts.map +1 -0
- package/dist/state/s3.js +19 -0
- package/dist/state/store.d.ts +51 -0
- package/dist/state/store.d.ts.map +1 -0
- package/dist/state/store.js +185 -0
- package/dist/state-ops.d.ts +255 -0
- package/dist/state-ops.d.ts.map +1 -0
- package/dist/state-ops.js +305 -0
- package/dist/state-reads.d.ts +57 -0
- package/dist/state-reads.d.ts.map +1 -0
- package/dist/state-reads.js +104 -0
- package/dist/terragrunt/affected.d.ts.map +1 -1
- package/dist/terragrunt/affected.js +2 -1
- package/dist/used-sources.d.ts +54 -0
- package/dist/used-sources.d.ts.map +1 -0
- package/dist/used-sources.js +157 -0
- package/package.json +24 -4
- package/src/__fixtures__/ACCEPTANCE.md +69 -7
- package/src/__fixtures__/compose/apply-failed-in-app.jsonl +12 -0
- package/src/__fixtures__/compose/state-app.json +66 -0
- package/src/__fixtures__/compose/state-edge.json +40 -0
- package/src/__fixtures__/compose/state-net.json +58 -0
- package/src/__fixtures__/compose/three-app.plan.json +184 -0
- package/src/__fixtures__/compose/three-composed.plan.json +509 -0
- package/src/__fixtures__/compose/three-edge.plan.json +144 -0
- package/src/__fixtures__/compose/three-net.plan.json +174 -0
- package/src/__fixtures__/compose/unknown-composed.plan.json +228 -0
- package/src/__fixtures__/compose/working-after-apply.json +145 -0
- package/src/__fixtures__/config-blocks/app/main.tf +61 -0
- package/src/__fixtures__/config-blocks/app/modules/network/main.tf +4 -0
- package/src/__fixtures__/config-blocks/app-json/main.tf.json +39 -0
- package/src/__fixtures__/config-files/shadow/main.tf +3 -0
- package/src/__fixtures__/config-files/shadow/main.tofu +3 -0
- package/src/__fixtures__/config-files/shadow/other.tf +3 -0
- package/src/__fixtures__/config-files/tf/main.tf +11 -0
- package/src/__fixtures__/config-files/tf-json/main.tf.json +18 -0
- package/src/__fixtures__/config-files/tofu/main.tofu +11 -0
- package/src/__fixtures__/config-files/tofu-json/main.tofu.json +18 -0
- package/src/__fixtures__/config-files/tofu-only/main.tofu +3 -0
- package/src/__fixtures__/drift-record/README.md +16 -0
- package/src/__fixtures__/drift-record/live-plan-sections.json +27 -0
- package/src/__fixtures__/drift-rows/live-root-plan.json +70 -0
- package/src/__fixtures__/drift-rows/refresh-plan.json +61 -0
- package/src/__fixtures__/instance-forms/app/main.tf +110 -0
- package/src/__fixtures__/instance-forms/app/modules/svc/main.tf +3 -0
- package/src/__fixtures__/instance-vars/app/main.tf +52 -0
- package/src/__fixtures__/instance-vars/app/modules/app/main.tf +12 -0
- package/src/__fixtures__/instance-vars/app/modules/edge/main.tf +3 -0
- package/src/__fixtures__/instance-vars/app/terraform.tfvars +1 -0
- package/src/__fixtures__/live-module-keyed/live-graph.json +259 -0
- package/src/__fixtures__/live-module-keyed/live-plan.json +87 -0
- package/src/__fixtures__/live-module-keyed/root/estate.chdf.hcl +1 -0
- package/src/__fixtures__/live-module-keyed/root/main.tf +21 -0
- package/src/__fixtures__/live-module-keyed/root/modules/app/main.tf +17 -0
- package/src/__fixtures__/live-module-keyed/root/modules/edge/main.tf +7 -0
- package/src/__fixtures__/live-module-keyed/root/versions.tf +30 -0
- package/src/__fixtures__/live-module-keyed/show-state.json +146 -0
- package/src/__fixtures__/pr-loop/README.md +50 -0
- package/src/__fixtures__/pr-loop/chant.config.json +13 -0
- package/src/__fixtures__/pr-loop/estate.component.ts +10 -0
- package/src/__fixtures__/pr-loop/roots/a/main.tf +11 -0
- package/src/__fixtures__/pr-loop/roots/app/main.tf +19 -0
- package/src/__fixtures__/pr-loop/roots/b/main.tf +7 -0
- package/src/__fixtures__/pr-loop/roots/dns/main.tf +3 -0
- package/src/__fixtures__/pr-loop/roots/net/main.tf +7 -0
- package/src/__fixtures__/report/applied.show.json +51 -0
- package/src/__fixtures__/report/generate.ts +63 -0
- package/src/__fixtures__/report/plan.show.json +200 -0
- package/src/__fixtures__/report/tf-apply/change-set.json +170 -0
- package/src/__fixtures__/report/tf-apply/report.json +338 -0
- package/src/__fixtures__/report/tf-plan/change-set.json +170 -0
- package/src/__fixtures__/report/tf-plan/report.json +320 -0
- package/src/__fixtures__/three-cloud-azure.graph.json +290 -0
- package/src/__fixtures__/used-sources/root/extra.tofu +1 -0
- package/src/__fixtures__/used-sources/root/main.tf +31 -0
- package/src/__fixtures__/used-sources/root/modules/net/main.tf +14 -0
- package/src/__fixtures__/used-sources/root/modules/net/versions.tf.json +7 -0
- package/src/__fixtures__/used-sources/unit/terragrunt.hcl +3 -0
- package/src/applied-state.ts +52 -0
- package/src/backend-config.test.ts +105 -0
- package/src/backend-config.ts +133 -0
- package/src/behaviour/kinds.ts +4 -0
- package/src/behaviour/predict.ts +5 -2
- package/src/behaviour/reference-catalog.plugin.test.ts +65 -0
- package/src/behaviour/reference-catalog.ts +16 -5
- package/src/behaviour/request.ts +3 -2
- package/src/change-set-instances.test.ts +98 -0
- package/src/changed-roots.ts +14 -16
- package/src/ci-setup.ts +42 -0
- package/src/commands.ts +4 -3
- package/src/components/capability-plugin.test.ts +198 -19
- package/src/components/capability-plugin.ts +383 -35
- package/src/components/change-set-graph.e2e.test.ts +11 -5
- package/src/components/compose-group.test.ts +486 -0
- package/src/components/compose-group.ts +489 -0
- package/src/components/demo-composed-roots.e2e.test.ts +440 -0
- package/src/components/member-outputs.test.ts +76 -0
- package/src/components/placeholder-preview.test.ts +147 -0
- package/src/components/placeholder-preview.ts +257 -0
- package/src/components/pr-loop-compose.tofu.e2e.test.ts +363 -0
- package/src/components/pr-loop.tofu.test.ts +113 -57
- package/src/components/release-inputs.ts +69 -0
- package/src/components/trace-facts.test.ts +21 -0
- package/src/components/trace-facts.ts +27 -0
- package/src/compose/apply-events.test.ts +62 -0
- package/src/compose/apply-events.ts +100 -0
- package/src/compose/estate.choudoufu.e2e.test.ts +112 -0
- package/src/compose/estate.test.ts +421 -0
- package/src/compose/estate.ts +443 -0
- package/src/compose/hcl.ts +311 -0
- package/src/compose/module-address.ts +49 -0
- package/src/compose/root.test.ts +416 -0
- package/src/compose/root.ts +592 -0
- package/src/compose/run.test.ts +440 -0
- package/src/compose/run.tofu.test.ts +176 -0
- package/src/compose/run.ts +527 -0
- package/src/compose/slice.test.ts +184 -0
- package/src/compose/slice.ts +290 -0
- package/src/compose/state-address.ts +157 -0
- package/src/compose/state-merge.test.ts +131 -0
- package/src/compose/state-merge.ts +148 -0
- package/src/compose.test.ts +248 -0
- package/src/compose.ts +627 -0
- package/src/composites/terraform-apply-op.test.ts +9 -0
- package/src/composites/terraform-apply-op.ts +7 -3
- package/src/cone.ts +138 -0
- package/src/config-file-listers.test.ts +265 -0
- package/src/config.ts +44 -9
- package/src/cost-hold.ts +29 -0
- package/src/describe-resources.engine-facts.test.ts +411 -0
- package/src/describe-resources.live-module-keyed.test.ts +290 -0
- package/src/describe-resources.ts +416 -70
- package/src/drift-read.ts +284 -0
- package/src/drift-record.test.ts +223 -0
- package/src/drift-record.ts +455 -0
- package/src/drift-rows.test.ts +135 -0
- package/src/drift-rows.ts +137 -0
- package/src/exit-codes.test.ts +23 -0
- package/src/exit-codes.ts +59 -0
- package/src/hcl/config-blocks.test.ts +174 -0
- package/src/hcl/edges.ts +21 -1
- package/src/hcl/files.ts +234 -0
- package/src/hcl/instance-forms.test.ts +94 -0
- package/src/hcl/instances.test.ts +137 -0
- package/src/hcl/instances.ts +422 -0
- package/src/hcl/parse.test.ts +139 -1
- package/src/hcl/parse.ts +149 -16
- package/src/hcl/roots.ts +6 -0
- package/src/hcl/suppressions.ts +8 -2
- package/src/index.ts +79 -0
- package/src/lint/audit-catalog.ts +29 -3
- package/src/lint/audit-lineage.ts +14 -2
- package/src/lint/post-synth/fixtures/TF024/live-with-record-store/main.tf +18 -0
- package/src/lint/post-synth/fixtures/TF024/sidecar-with-backend/estate.chdf.hcl +1 -0
- package/src/lint/post-synth/fixtures/TF024/sidecar-with-backend/main.tf +10 -0
- package/src/lint/post-synth/fixtures/TF046/azurerm-no-resource-group/main.tf +15 -0
- package/src/lint/post-synth/fixtures/TF046/backend-config-only/main.tf +14 -0
- package/src/lint/post-synth/fixtures/TF046/derived-s3/backend.tf +7 -0
- package/src/lint/post-synth/fixtures/TF046/derived-s3/main.tf +9 -0
- package/src/lint/post-synth/fixtures/TF046/explicit-local/main.tf +16 -0
- package/src/lint/post-synth/fixtures/TF046/explicit-s3-beside-local-backend/main.tf +15 -0
- package/src/lint/post-synth/fixtures/TF046/implied-local/main.tf +9 -0
- package/src/lint/post-synth/fixtures/TF046/sidecar-implied/estate.chdf.hcl +1 -0
- package/src/lint/post-synth/fixtures/TF046/sidecar-implied/main.tf +5 -0
- package/src/lint/post-synth/fixtures/TF047/clear/main.tf +12 -0
- package/src/lint/post-synth/fixtures/TF047/refused/main.tf +12 -0
- package/src/lint/post-synth/fixtures/TF047/unknown-module/main.tf +12 -0
- package/src/lint/post-synth/fixtures/TF047/unknown-version/main.tf +12 -0
- package/src/lint/post-synth/index.ts +4 -0
- package/src/lint/post-synth/record-store.ts +122 -0
- package/src/lint/post-synth/tf001.ts +2 -2
- package/src/lint/post-synth/tf024.test.ts +26 -5
- package/src/lint/post-synth/tf024.ts +105 -22
- package/src/lint/post-synth/tf046.test.ts +137 -0
- package/src/lint/post-synth/tf046.ts +204 -0
- package/src/lint/post-synth/tf047.test.ts +56 -0
- package/src/lint/post-synth/tf047.ts +114 -0
- package/src/live-plan-reasons.ts +54 -0
- package/src/lock-rows.test.ts +70 -0
- package/src/lock-rows.ts +82 -0
- package/src/lock-timeout.ts +34 -0
- package/src/lsp/completions.test.ts +1 -1
- package/src/lsp/option-keys.ts +2 -0
- package/src/module-catalog/index.test.ts +93 -0
- package/src/module-catalog/index.ts +159 -0
- package/src/module-catalog/refresh-cli.ts +68 -0
- package/src/module-catalog/static-tier.ts +1659 -0
- package/src/module-catalog/types.ts +88 -0
- package/src/op/activities/choudoufu-plan-set-op.test.ts +111 -0
- package/src/op/activities/index.ts +9 -0
- package/src/op/activities/live-detect.ts +55 -26
- package/src/op/activities/pin-rollout.ts +3 -0
- package/src/op/activities/registry.test.ts +2 -1
- package/src/op/activities/terraform.test.ts +55 -0
- package/src/op/activities/terraform.ts +312 -27
- package/src/op/activity-contracts.test.ts +1 -0
- package/src/op/activity-contracts.ts +24 -1
- package/src/op/builders.ts +14 -0
- package/src/op-wave-step.test.ts +109 -0
- package/src/pin/__fixtures__/consumers/live/dev/main.tf +4 -0
- package/src/pin/__fixtures__/consumers/live/prod/main.tf +21 -0
- package/src/pin/__fixtures__/consumers/units/vpc/terragrunt.hcl +7 -0
- package/src/pin/bundle.test.ts +2 -0
- package/src/pin/consumers.test.ts +57 -0
- package/src/pin/consumers.ts +95 -0
- package/src/pin/edit.ts +30 -0
- package/src/pin/rollout.ts +16 -11
- package/src/plan-shape.test.ts +148 -0
- package/src/plan-shape.ts +128 -0
- package/src/plugin.ts +39 -19
- package/src/registry/__fixtures__/docs/documented/.terraform-docs.yml +3 -0
- package/src/registry/__fixtures__/docs/documented/README.md +1 -0
- package/src/registry/__fixtures__/docs/documented/main.tf +8 -0
- package/src/registry/__fixtures__/docs/json/main.tf.json +14 -0
- package/src/registry/__fixtures__/docs/vpc/README.md +3 -0
- package/src/registry/__fixtures__/docs/vpc/examples/complete/main.tf +5 -0
- package/src/registry/__fixtures__/docs/vpc/examples/simple/README.md +1 -0
- package/src/registry/__fixtures__/docs/vpc/examples/simple/main.tf +4 -0
- package/src/registry/__fixtures__/docs/vpc/main.tf +14 -0
- package/src/registry/__fixtures__/docs/vpc/outputs.tf +9 -0
- package/src/registry/__fixtures__/docs/vpc/variables.tf +16 -0
- package/src/registry/__fixtures__/proxied-root/main.tf +12 -0
- package/src/registry/address.ts +100 -0
- package/src/registry/catalog-read.ts +56 -0
- package/src/registry/deprecated.test.ts +139 -0
- package/src/registry/deprecated.ts +76 -0
- package/src/registry/docs.test.ts +140 -0
- package/src/registry/docs.ts +299 -0
- package/src/registry/edge/bundle.test.ts +50 -0
- package/src/registry/edge/edge.test.ts +176 -0
- package/src/registry/edge/edge.ts +211 -0
- package/src/registry/edge/index.ts +10 -0
- package/src/registry/edge/lambda-edge.ts +127 -0
- package/src/registry/edge/sigv4-web.ts +79 -0
- package/src/registry/edge/token-source.test.ts +258 -0
- package/src/registry/edge/token-source.ts +169 -0
- package/src/registry/edge/worker.ts +61 -0
- package/src/registry/handler.ts +89 -0
- package/src/registry/headers-file.ts +61 -0
- package/src/registry/index.ts +31 -0
- package/src/registry/mirror-paths.ts +10 -0
- package/src/registry/mirror.test.ts +198 -0
- package/src/registry/mirror.ts +395 -0
- package/src/registry/proxies.test.ts +153 -0
- package/src/registry/proxies.ts +132 -0
- package/src/registry/reader.ts +225 -0
- package/src/registry/registry.test.ts +262 -0
- package/src/registry/semver.ts +34 -0
- package/src/registry/serve.ts +82 -0
- package/src/registry/source-forms.test.ts +87 -0
- package/src/registry/source-forms.ts +216 -0
- package/src/registry/targets/artifactory.test.ts +248 -0
- package/src/registry/targets/artifactory.ts +257 -0
- package/src/registry/targets/fake-artifactory.ts +158 -0
- package/src/registry/targets/fake-gitlab.ts +161 -0
- package/src/registry/targets/fake-hcp.ts +233 -0
- package/src/registry/targets/fake-http.ts +97 -0
- package/src/registry/targets/fake-nexus.ts +152 -0
- package/src/registry/targets/gitlab.test.ts +208 -0
- package/src/registry/targets/gitlab.ts +223 -0
- package/src/registry/targets/hcp.test.ts +230 -0
- package/src/registry/targets/hcp.ts +360 -0
- package/src/registry/targets/hosted.ts +117 -0
- package/src/registry/targets/index.ts +17 -0
- package/src/registry/targets/module-target.ts +131 -0
- package/src/registry/targets/nexus.test.ts +220 -0
- package/src/registry/targets/nexus.ts +314 -0
- package/src/registry/targets/zip.test.ts +65 -0
- package/src/registry/targets/zip.ts +287 -0
- package/src/registry/writer.ts +155 -0
- package/src/report.test.ts +82 -1
- package/src/report.ts +31 -54
- package/src/signal-only-root.test.ts +72 -0
- package/src/skills/chant-terraform.md +1 -1
- package/src/state/azure-blob.ts +8 -0
- package/src/state/backend-verdict.test.ts +187 -0
- package/src/state/backend.test.ts +127 -0
- package/src/state/backend.ts +488 -0
- package/src/state/exec.ts +111 -0
- package/src/state/gcs.ts +7 -0
- package/src/state/index.ts +15 -0
- package/src/state/locks.test.ts +84 -0
- package/src/state/locks.ts +201 -0
- package/src/state/object-store.ts +7 -0
- package/src/state/root-states-floci.e2e.test.ts +66 -0
- package/src/state/root-states.test.ts +462 -0
- package/src/state/root-states.ts +309 -0
- package/src/state/s3.ts +21 -0
- package/src/state/store.ts +225 -0
- package/src/state-ops.test.ts +182 -0
- package/src/state-ops.ts +462 -0
- package/src/state-reads.ts +116 -0
- package/src/terragrunt/affected.ts +2 -1
- package/src/used-sources.test.ts +75 -0
- package/src/used-sources.ts +204 -0
- package/src/workspace-kinds.test.ts +4 -17
- package/workspace-kinds.json +1 -24
- package/dist/workspace-member.d.ts +0 -30
- package/dist/workspace-member.d.ts.map +0 -1
- package/dist/workspace-member.js +0 -91
- package/schemas/pulumi.schema.json +0 -34
- package/src/testdata/pulumi-member/Pulumi.yaml +0 -2
- package/src/testdata/pulumi-member/stack-export.json +0 -53
- package/src/testdata/pulumi-unexported/Pulumi.yaml +0 -2
- package/src/workspace-member.test.ts +0 -89
- package/src/workspace-member.ts +0 -126
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The record store a live root resolves to, read from its HCL the way
|
|
3
|
+
* choudoufu resolves it (INTENTIUS/choudoufu#2293, `internal/configs/live_derive.go`
|
|
4
|
+
* at choudoufu 74ffde956bfd97f44b8ad444424584e23321adc2). Shared by TF024,
|
|
5
|
+
* which names where records go, and TF046, which guards a CI root that ends
|
|
6
|
+
* up on the local store, so the two never disagree.
|
|
7
|
+
*
|
|
8
|
+
* The order is choudoufu's:
|
|
9
|
+
*
|
|
10
|
+
* 1. A `record_store "<kind>"` block in the `live` block or the
|
|
11
|
+
* `estate.chdf.hcl` sidecar always wins (`source: "record_store"`).
|
|
12
|
+
* 2. Otherwise the backend block choudoufu ignores under live gives the store,
|
|
13
|
+
* s3 to s3, gcs to gcs, azurerm to azurerm (`source: "backend"`). s3 and gcs
|
|
14
|
+
* need a literal `bucket`; azurerm needs literal `storage_account_name`,
|
|
15
|
+
* `container_name` and `resource_group_name`. A value passed only with
|
|
16
|
+
* `-backend-config` is not in the configuration, so choudoufu does not see
|
|
17
|
+
* it either.
|
|
18
|
+
* 3. Otherwise the store is local (`source: "implied"`), with `note` saying
|
|
19
|
+
* why a backend that was there was not used.
|
|
20
|
+
*
|
|
21
|
+
* This mirrors `record_store.source` and `record_store.note` in
|
|
22
|
+
* `choudoufu live-check -json`. A literal here is a string hcl2json hands back
|
|
23
|
+
* with no `${...}` in it, the same "not determined" reading the Terragrunt
|
|
24
|
+
* rules use (`./terragrunt.ts`).
|
|
25
|
+
*/
|
|
26
|
+
import { backendTypes } from "./tf001.js";
|
|
27
|
+
import { isExpression } from "./terragrunt.js";
|
|
28
|
+
/** Backend types choudoufu derives a record store from (INTENTIUS/choudoufu#2293). */
|
|
29
|
+
export const DERIVABLE_BACKENDS = new Set(["s3", "gcs", "azurerm"]);
|
|
30
|
+
const asRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
|
|
31
|
+
const firstBody = (v) => asRecord(Array.isArray(v) ? v[0] : v);
|
|
32
|
+
/**
|
|
33
|
+
* The label of a `record_store "<kind>"` block in a live declaration body, or
|
|
34
|
+
* undefined when it declares none. hcl2json nests the label one level down,
|
|
35
|
+
* as it does for `backend` (see `backendTypes` in `./tf001.ts`).
|
|
36
|
+
*/
|
|
37
|
+
export function recordStoreKind(liveBody) {
|
|
38
|
+
const raw = liveBody["record_store"];
|
|
39
|
+
if (raw === undefined || raw === null)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (typeof raw !== "object" || Array.isArray(raw))
|
|
42
|
+
return undefined;
|
|
43
|
+
const labels = Object.keys(raw);
|
|
44
|
+
return labels[0];
|
|
45
|
+
}
|
|
46
|
+
/** A top-level backend argument as a literal string, or undefined when it is absent, empty or an expression. */
|
|
47
|
+
function literal(body, name) {
|
|
48
|
+
const v = body[name];
|
|
49
|
+
if (typeof v !== "string" || v === "" || isExpression(v))
|
|
50
|
+
return undefined;
|
|
51
|
+
return v;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Why a backend block gives no record store, or undefined when it gives one.
|
|
55
|
+
* The wording follows choudoufu's `Live.RecordStoreNote`; an empty string
|
|
56
|
+
* means no store and nothing to say (a `local` backend).
|
|
57
|
+
*/
|
|
58
|
+
function derivationNote(type, body) {
|
|
59
|
+
const where = `backend "${type}"`;
|
|
60
|
+
switch (type) {
|
|
61
|
+
case "s3":
|
|
62
|
+
case "gcs":
|
|
63
|
+
return literal(body, "bucket") === undefined
|
|
64
|
+
? `${where} sets no literal bucket; values passed with -backend-config are not read`
|
|
65
|
+
: undefined;
|
|
66
|
+
case "azurerm":
|
|
67
|
+
for (const name of ["storage_account_name", "container_name", "resource_group_name"]) {
|
|
68
|
+
if (literal(body, name) === undefined)
|
|
69
|
+
return `${where} sets no literal ${name}, which the azurerm record store needs`;
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
case "local":
|
|
73
|
+
// choudoufu leaves no note here: a local backend and the local store agree.
|
|
74
|
+
return "";
|
|
75
|
+
default:
|
|
76
|
+
return `${where} has no record store counterpart`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Resolve one live root's record store.
|
|
81
|
+
*
|
|
82
|
+
* `terraformBodies` are the bodies of every `terraform` block in the root (a
|
|
83
|
+
* backend can sit in a separate `backend.tf`). `liveBodies` are the root's
|
|
84
|
+
* live declarations: its `live` block and its sidecar, if any. choudoufu
|
|
85
|
+
* refuses a root that has both, so the first `record_store` found is the one.
|
|
86
|
+
*/
|
|
87
|
+
export function resolveRecordStore(terraformBodies, liveBodies) {
|
|
88
|
+
for (const live of liveBodies) {
|
|
89
|
+
const kind = recordStoreKind(live);
|
|
90
|
+
if (kind !== undefined)
|
|
91
|
+
return { kind, source: "record_store" };
|
|
92
|
+
}
|
|
93
|
+
for (const tf of terraformBodies) {
|
|
94
|
+
const type = backendTypes(tf)[0];
|
|
95
|
+
if (type === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
const body = firstBody(asRecord(tf["backend"])[type]);
|
|
98
|
+
const note = derivationNote(type, body);
|
|
99
|
+
if (note === undefined)
|
|
100
|
+
return { kind: type, source: "backend", backend: type };
|
|
101
|
+
return { kind: "local", source: "implied", backend: type, ...(note ? { note } : {}) };
|
|
102
|
+
}
|
|
103
|
+
return { kind: "local", source: "implied" };
|
|
104
|
+
}
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* module's `terraform` block is skipped here rather than read as if it were
|
|
31
31
|
* the root's.
|
|
32
32
|
*
|
|
33
|
-
* Does not fire on a live root (#2103): a `backend` block
|
|
34
|
-
*
|
|
33
|
+
* Does not fire on a live root (#2103): choudoufu ignores a `backend` block
|
|
34
|
+
* there (TF024 reports what it still does with it), and the fallback to local
|
|
35
35
|
* state this check warns about does not apply, since a live root keeps no
|
|
36
36
|
* state file at all, local or remote.
|
|
37
37
|
*/
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* module's `terraform` block is skipped here rather than read as if it were
|
|
31
31
|
* the root's.
|
|
32
32
|
*
|
|
33
|
-
* Does not fire on a live root (#2103): a `backend` block
|
|
34
|
-
*
|
|
33
|
+
* Does not fire on a live root (#2103): choudoufu ignores a `backend` block
|
|
34
|
+
* there (TF024 reports what it still does with it), and the fallback to local
|
|
35
35
|
* state this check warns about does not apply, since a live root keeps no
|
|
36
36
|
* state file at all, local or remote.
|
|
37
37
|
*/
|
|
@@ -1,24 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TF024: a live root declares a `backend` or `cloud` block.
|
|
3
3
|
*
|
|
4
|
-
* choudoufu
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* choudoufu used to refuse this pair at `init` (#1170). Since
|
|
5
|
+
* INTENTIUS/choudoufu#2213 it accepts both and ignores them with a warning
|
|
6
|
+
* (`internal/configs/module.go`, `ignoreStateStoreUnderLive`), because
|
|
7
|
+
* Terragrunt's `remote_state` and Atmos's `backend.tf.json` write a backend
|
|
8
|
+
* beside the live block on every run. What each block still does:
|
|
9
|
+
*
|
|
10
|
+
* - `backend "<type>"`: no state is read or written there, and
|
|
11
|
+
* `init -migrate-state` is refused. choudoufu keeps the block as
|
|
12
|
+
* `IgnoredBackend`: an apply publishes the estate's non-sensitive outputs
|
|
13
|
+
* to the location it names, so `terraform_remote_state` readers keep
|
|
14
|
+
* working, and when the live declaration has no `record_store` the record
|
|
15
|
+
* store is derived from the backend's bucket, s3 to s3, gcs to gcs, azurerm
|
|
16
|
+
* to azurerm (INTENTIUS/choudoufu#2293), when the bucket is a literal in
|
|
17
|
+
* the configuration. An explicit `record_store` always wins. The resolution
|
|
18
|
+
* is shared with TF046 in `./record-store.ts`.
|
|
19
|
+
* - `cloud {}`: dropped entirely. Nothing is published to it and no store is
|
|
20
|
+
* derived from it.
|
|
21
|
+
*
|
|
22
|
+
* So the backend case is reported as `info` (the block is doing a job the
|
|
23
|
+
* author may want, and is the derivation source the maintainer ruled for),
|
|
24
|
+
* and the cloud case as `warning` (the block does nothing at all). Neither
|
|
25
|
+
* fails a build at default severity. The guard against a CI root that ends
|
|
26
|
+
* up on the local store is TF046 (chant#4561).
|
|
27
|
+
*
|
|
28
|
+
* The live marker is the root's `mode`, stamped from either a `live` block or
|
|
29
|
+
* an `estate.chdf.hcl` sidecar (`hcl/parse.ts`), so a sidecar estate is
|
|
30
|
+
* covered. A `record_store` is read from whichever `Terraform::Live` entity
|
|
31
|
+
* carries it: the `live` block, or the sidecar's top level.
|
|
11
32
|
*
|
|
12
33
|
* TF001 is the equivalent check for a stock root (no remote backend is
|
|
13
|
-
* configured); it
|
|
14
|
-
*
|
|
15
|
-
* at most one of them.
|
|
34
|
+
* configured); it does not fire on a live root. A root is flagged by at most
|
|
35
|
+
* one of them.
|
|
16
36
|
*
|
|
17
37
|
* Scope: root modules only (#2112). A child module's backend or cloud block
|
|
18
38
|
* is TF015's finding, whatever binary the root runs.
|
|
19
39
|
*
|
|
20
40
|
* One diagnostic per root, fired from the root's `terraform` block.
|
|
21
41
|
*/
|
|
22
|
-
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
42
|
+
import type { PostSynthCheck, PostSynthContext } from "@intentius/chant/lint/post-synth";
|
|
43
|
+
import { type BlockBody } from "../../hcl/parse.js";
|
|
44
|
+
export { DERIVABLE_BACKENDS } from "./record-store.js";
|
|
45
|
+
/** Each root's live declarations (its `live` block and its sidecar), keyed by root. */
|
|
46
|
+
export declare function liveBodiesByRoot(ctx: PostSynthContext): Map<string, BlockBody[]>;
|
|
23
47
|
export declare const tf024: PostSynthCheck;
|
|
24
48
|
//# sourceMappingURL=tf024.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tf024.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf024.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tf024.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf024.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAEjB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAKpD,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAYhF;AAqCD,eAAO,MAAM,KAAK,EAAE,cA4CnB,CAAC"}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TF024: a live root declares a `backend` or `cloud` block.
|
|
3
3
|
*
|
|
4
|
-
* choudoufu
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* choudoufu used to refuse this pair at `init` (#1170). Since
|
|
5
|
+
* INTENTIUS/choudoufu#2213 it accepts both and ignores them with a warning
|
|
6
|
+
* (`internal/configs/module.go`, `ignoreStateStoreUnderLive`), because
|
|
7
|
+
* Terragrunt's `remote_state` and Atmos's `backend.tf.json` write a backend
|
|
8
|
+
* beside the live block on every run. What each block still does:
|
|
9
|
+
*
|
|
10
|
+
* - `backend "<type>"`: no state is read or written there, and
|
|
11
|
+
* `init -migrate-state` is refused. choudoufu keeps the block as
|
|
12
|
+
* `IgnoredBackend`: an apply publishes the estate's non-sensitive outputs
|
|
13
|
+
* to the location it names, so `terraform_remote_state` readers keep
|
|
14
|
+
* working, and when the live declaration has no `record_store` the record
|
|
15
|
+
* store is derived from the backend's bucket, s3 to s3, gcs to gcs, azurerm
|
|
16
|
+
* to azurerm (INTENTIUS/choudoufu#2293), when the bucket is a literal in
|
|
17
|
+
* the configuration. An explicit `record_store` always wins. The resolution
|
|
18
|
+
* is shared with TF046 in `./record-store.ts`.
|
|
19
|
+
* - `cloud {}`: dropped entirely. Nothing is published to it and no store is
|
|
20
|
+
* derived from it.
|
|
21
|
+
*
|
|
22
|
+
* So the backend case is reported as `info` (the block is doing a job the
|
|
23
|
+
* author may want, and is the derivation source the maintainer ruled for),
|
|
24
|
+
* and the cloud case as `warning` (the block does nothing at all). Neither
|
|
25
|
+
* fails a build at default severity. The guard against a CI root that ends
|
|
26
|
+
* up on the local store is TF046 (chant#4561).
|
|
27
|
+
*
|
|
28
|
+
* The live marker is the root's `mode`, stamped from either a `live` block or
|
|
29
|
+
* an `estate.chdf.hcl` sidecar (`hcl/parse.ts`), so a sidecar estate is
|
|
30
|
+
* covered. A `record_store` is read from whichever `Terraform::Live` entity
|
|
31
|
+
* carries it: the `live` block, or the sidecar's top level.
|
|
11
32
|
*
|
|
12
33
|
* TF001 is the equivalent check for a stock root (no remote backend is
|
|
13
|
-
* configured); it
|
|
14
|
-
*
|
|
15
|
-
* at most one of them.
|
|
34
|
+
* configured); it does not fire on a live root. A root is flagged by at most
|
|
35
|
+
* one of them.
|
|
16
36
|
*
|
|
17
37
|
* Scope: root modules only (#2112). A child module's backend or cloud block
|
|
18
38
|
* is TF015's finding, whatever binary the root runs.
|
|
@@ -20,15 +40,61 @@
|
|
|
20
40
|
* One diagnostic per root, fired from the root's `terraform` block.
|
|
21
41
|
*/
|
|
22
42
|
import { isResourceDeclarable } from "@intentius/chant/declarable";
|
|
23
|
-
import { TERRAFORM_TYPE } from "../../hcl/parse.js";
|
|
24
|
-
import { hasBlock } from "./tf001.js";
|
|
43
|
+
import { LIVE_TYPE, TERRAFORM_TYPE } from "../../hcl/parse.js";
|
|
44
|
+
import { backendTypes, hasBlock } from "./tf001.js";
|
|
25
45
|
import { isRootScoped } from "./scope.js";
|
|
46
|
+
import { DERIVABLE_BACKENDS, resolveRecordStore } from "./record-store.js";
|
|
47
|
+
export { DERIVABLE_BACKENDS } from "./record-store.js";
|
|
48
|
+
const bodyOf = (props) => (typeof props.body === "object" && props.body !== null ? props.body : {});
|
|
49
|
+
/** Each root's live declarations (its `live` block and its sidecar), keyed by root. */
|
|
50
|
+
export function liveBodiesByRoot(ctx) {
|
|
51
|
+
const roots = new Map();
|
|
52
|
+
for (const entity of ctx.entities.values()) {
|
|
53
|
+
if (entity.entityType !== LIVE_TYPE)
|
|
54
|
+
continue;
|
|
55
|
+
if (!isResourceDeclarable(entity) || !isRootScoped(entity))
|
|
56
|
+
continue;
|
|
57
|
+
const props = entity.props;
|
|
58
|
+
const root = typeof props.root === "string" ? props.root : "";
|
|
59
|
+
const list = roots.get(root) ?? [];
|
|
60
|
+
list.push(bodyOf(props));
|
|
61
|
+
roots.set(root, list);
|
|
62
|
+
}
|
|
63
|
+
return roots;
|
|
64
|
+
}
|
|
65
|
+
function backendMessage(root, type, store) {
|
|
66
|
+
const label = type ? `backend "${type}"` : "backend";
|
|
67
|
+
const head = `Root module "${root}" runs choudoufu with a declared estate and also declares a ${label} block. ` +
|
|
68
|
+
"choudoufu ignores it with a warning: no state is read or written there and `init -migrate-state` " +
|
|
69
|
+
"is refused. An apply publishes the estate's non-sensitive outputs to the location it names, so " +
|
|
70
|
+
"terraform_remote_state readers keep working.";
|
|
71
|
+
if (store.source === "record_store") {
|
|
72
|
+
return `${head} Records go to the record_store the live declaration names, which wins over the backend.`;
|
|
73
|
+
}
|
|
74
|
+
if (store.source === "backend") {
|
|
75
|
+
return (`${head} With no record_store declared, choudoufu derives the record store from this backend's ` +
|
|
76
|
+
"bucket and prints it on every init and plan (INTENTIUS/choudoufu#2293). Declare record_store to " +
|
|
77
|
+
"put records somewhere else.");
|
|
78
|
+
}
|
|
79
|
+
const why = DERIVABLE_BACKENDS.has(type) && store.note
|
|
80
|
+
? `No record store is derived from it: ${store.note}.`
|
|
81
|
+
: `No record store is derived from a ${type ? `"${type}"` : "backend of unknown type"} (only s3, gcs and azurerm are).`;
|
|
82
|
+
return (`${head} ${why} No record_store is declared, so records stay in the local ` +
|
|
83
|
+
"store. Declare record_store if more than one machine runs this root (TF046 guards this in CI).");
|
|
84
|
+
}
|
|
85
|
+
function cloudMessage(root) {
|
|
86
|
+
return (`Root module "${root}" runs choudoufu with a declared estate and also declares a cloud block. ` +
|
|
87
|
+
"choudoufu ignores it entirely: no state is read or written there, no outputs are published to it, " +
|
|
88
|
+
"and no record store is derived from it. Remove it, or use a backend block if " +
|
|
89
|
+
"terraform_remote_state readers need this estate's outputs.");
|
|
90
|
+
}
|
|
26
91
|
export const tf024 = {
|
|
27
92
|
id: "TF024",
|
|
28
|
-
description: "Live root declares a backend or cloud block, which choudoufu
|
|
93
|
+
description: "Live root declares a backend or cloud block, which choudoufu ignores",
|
|
29
94
|
check(ctx) {
|
|
30
95
|
const diagnostics = [];
|
|
31
96
|
const flagged = new Set();
|
|
97
|
+
let liveBodies;
|
|
32
98
|
for (const [name, entity] of ctx.entities) {
|
|
33
99
|
if (entity.entityType !== TERRAFORM_TYPE)
|
|
34
100
|
continue;
|
|
@@ -40,19 +106,25 @@ export const tf024 = {
|
|
|
40
106
|
const root = typeof props.root === "string" ? props.root : "";
|
|
41
107
|
if (flagged.has(root))
|
|
42
108
|
continue;
|
|
43
|
-
const body = (
|
|
44
|
-
const hasBackend = hasBlock(body, "backend");
|
|
109
|
+
const body = bodyOf(props);
|
|
45
110
|
const hasCloud = hasBlock(body, "cloud");
|
|
111
|
+
const hasBackend = hasBlock(body, "backend");
|
|
46
112
|
if (!hasBackend && !hasCloud)
|
|
47
113
|
continue;
|
|
48
114
|
flagged.add(root);
|
|
49
|
-
|
|
115
|
+
// A cloud block does nothing at all, so it is the one worth a warning
|
|
116
|
+
// when a (malformed) root somehow carries both.
|
|
117
|
+
if (hasCloud) {
|
|
118
|
+
diagnostics.push({ checkId: "TF024", severity: "warning", message: cloudMessage(root), entity: name, lexicon: "terraform" });
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
liveBodies ?? (liveBodies = liveBodiesByRoot(ctx));
|
|
122
|
+
const type = backendTypes(body)[0] ?? "";
|
|
123
|
+
const store = resolveRecordStore([body], liveBodies.get(root) ?? []);
|
|
50
124
|
diagnostics.push({
|
|
51
125
|
checkId: "TF024",
|
|
52
|
-
severity: "
|
|
53
|
-
message:
|
|
54
|
-
`${blockKind} block. choudoufu refuses this at init: "Both a ${blockKind} and a live ` +
|
|
55
|
-
`configuration are present." Remove the ${blockKind} block; a live root keeps no state to store.`,
|
|
126
|
+
severity: "info",
|
|
127
|
+
message: backendMessage(root, type, store),
|
|
56
128
|
entity: name,
|
|
57
129
|
lexicon: "terraform",
|
|
58
130
|
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TF046: a live root's record store is local, and the lint runs in CI.
|
|
3
|
+
*
|
|
4
|
+
* A live root keeps its records (what binds a record-backed resource to the
|
|
5
|
+
* estate) in a record store. With nothing to say otherwise that store is a
|
|
6
|
+
* directory beside the module (choudoufu `live/STORAGE.md`), and on a CI
|
|
7
|
+
* runner the directory is empty on every run: an ordinary resource still binds
|
|
8
|
+
* by its marker, but a record-backed one is proposed for create again.
|
|
9
|
+
*
|
|
10
|
+
* "Local" is what choudoufu resolves, read here through `./record-store.ts`,
|
|
11
|
+
* the same resolution TF024 names in its message (INTENTIUS/choudoufu#2293):
|
|
12
|
+
*
|
|
13
|
+
* - an explicit `record_store "local"` fires;
|
|
14
|
+
* - an explicit `record_store` of any other kind is quiet, whatever backend
|
|
15
|
+
* sits beside it;
|
|
16
|
+
* - with no `record_store`, an ignored `backend "s3"`, `"gcs"` or `"azurerm"`
|
|
17
|
+
* block that names its bucket as a literal gives a derived store and is
|
|
18
|
+
* quiet;
|
|
19
|
+
* - with no `record_store` and no backend, or a backend with no counterpart
|
|
20
|
+
* (`local`, `consul`, `http`), or one whose bucket comes only from
|
|
21
|
+
* `-backend-config`, the store is implied local and the rule fires, naming
|
|
22
|
+
* the reason choudoufu would print.
|
|
23
|
+
*
|
|
24
|
+
* A root that is also a Terragrunt unit with a `remote_state`, a `generate`
|
|
25
|
+
* block that writes a backend, or an `include` of a parent config gets its
|
|
26
|
+
* backend file at run time, so what chant reads is not what choudoufu sees.
|
|
27
|
+
* The rule stays quiet there rather than guess; TF044 still reports a
|
|
28
|
+
* Terragrunt `backend = "local"`.
|
|
29
|
+
*
|
|
30
|
+
* CI is read from the environment chant runs in: `CI` set to anything but
|
|
31
|
+
* `false` or `0`, or `GITHUB_ACTIONS`, `GITLAB_CI`, `FORGEJO_ACTIONS`,
|
|
32
|
+
* `GITEA_ACTIONS` or `TF_BUILD` (Azure Pipelines) set to `true`. Outside CI the
|
|
33
|
+
* local store is a reasonable choice for one person or a demo, and the rule
|
|
34
|
+
* says nothing.
|
|
35
|
+
*
|
|
36
|
+
* Opt-outs, for emulator and test lanes that use the local store on purpose:
|
|
37
|
+
* `CHANT_ALLOW_LOCAL_RECORD_STORE=1` in the lane's environment, or
|
|
38
|
+
* `# chant-ignore-block: TF046` above the `terraform` block holding `live`
|
|
39
|
+
* for one root, or
|
|
40
|
+
* `lint.rules: { TF046: "off" }` for a whole project.
|
|
41
|
+
*
|
|
42
|
+
* The rule is `report-only` in the audit catalog, so it is off under the
|
|
43
|
+
* `recommended` preset: terragucci switches it on and holds the product
|
|
44
|
+
* wording (chant#4561 placement).
|
|
45
|
+
*
|
|
46
|
+
* One diagnostic per root. It fires from the `terraform` block that holds the
|
|
47
|
+
* `live` block, since suppression comments anchor on top-level blocks only,
|
|
48
|
+
* and from the sidecar's `Terraform::Live` entity for a sidecar estate, where
|
|
49
|
+
* `# chant-ignore-file: TF046` in `estate.chdf.hcl` suppresses it.
|
|
50
|
+
*/
|
|
51
|
+
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
52
|
+
/** The environment variable an emulator or test lane sets to keep the local store without a finding. */
|
|
53
|
+
export declare const ALLOW_LOCAL_RECORD_STORE_ENV = "CHANT_ALLOW_LOCAL_RECORD_STORE";
|
|
54
|
+
type Env = Readonly<Record<string, string | undefined>>;
|
|
55
|
+
/** Whether the environment is a CI job. */
|
|
56
|
+
export declare function isCiEnvironment(env: Env): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* TF046 against an explicit environment. `tf046.check` passes `process.env`;
|
|
59
|
+
* tests pass their own.
|
|
60
|
+
*/
|
|
61
|
+
export declare function checkLocalRecordStore(ctx: PostSynthContext, env: Env): PostSynthDiagnostic[];
|
|
62
|
+
export declare const tf046: PostSynthCheck;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=tf046.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tf046.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf046.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAa1C,wGAAwG;AACxG,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAE7E,KAAK,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAIxD,2CAA2C;AAC3C,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAMjD;AA4FD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,GAAG,mBAAmB,EAAE,CAgB5F;AAED,eAAO,MAAM,KAAK,EAAE,cAOnB,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TF046: a live root's record store is local, and the lint runs in CI.
|
|
3
|
+
*
|
|
4
|
+
* A live root keeps its records (what binds a record-backed resource to the
|
|
5
|
+
* estate) in a record store. With nothing to say otherwise that store is a
|
|
6
|
+
* directory beside the module (choudoufu `live/STORAGE.md`), and on a CI
|
|
7
|
+
* runner the directory is empty on every run: an ordinary resource still binds
|
|
8
|
+
* by its marker, but a record-backed one is proposed for create again.
|
|
9
|
+
*
|
|
10
|
+
* "Local" is what choudoufu resolves, read here through `./record-store.ts`,
|
|
11
|
+
* the same resolution TF024 names in its message (INTENTIUS/choudoufu#2293):
|
|
12
|
+
*
|
|
13
|
+
* - an explicit `record_store "local"` fires;
|
|
14
|
+
* - an explicit `record_store` of any other kind is quiet, whatever backend
|
|
15
|
+
* sits beside it;
|
|
16
|
+
* - with no `record_store`, an ignored `backend "s3"`, `"gcs"` or `"azurerm"`
|
|
17
|
+
* block that names its bucket as a literal gives a derived store and is
|
|
18
|
+
* quiet;
|
|
19
|
+
* - with no `record_store` and no backend, or a backend with no counterpart
|
|
20
|
+
* (`local`, `consul`, `http`), or one whose bucket comes only from
|
|
21
|
+
* `-backend-config`, the store is implied local and the rule fires, naming
|
|
22
|
+
* the reason choudoufu would print.
|
|
23
|
+
*
|
|
24
|
+
* A root that is also a Terragrunt unit with a `remote_state`, a `generate`
|
|
25
|
+
* block that writes a backend, or an `include` of a parent config gets its
|
|
26
|
+
* backend file at run time, so what chant reads is not what choudoufu sees.
|
|
27
|
+
* The rule stays quiet there rather than guess; TF044 still reports a
|
|
28
|
+
* Terragrunt `backend = "local"`.
|
|
29
|
+
*
|
|
30
|
+
* CI is read from the environment chant runs in: `CI` set to anything but
|
|
31
|
+
* `false` or `0`, or `GITHUB_ACTIONS`, `GITLAB_CI`, `FORGEJO_ACTIONS`,
|
|
32
|
+
* `GITEA_ACTIONS` or `TF_BUILD` (Azure Pipelines) set to `true`. Outside CI the
|
|
33
|
+
* local store is a reasonable choice for one person or a demo, and the rule
|
|
34
|
+
* says nothing.
|
|
35
|
+
*
|
|
36
|
+
* Opt-outs, for emulator and test lanes that use the local store on purpose:
|
|
37
|
+
* `CHANT_ALLOW_LOCAL_RECORD_STORE=1` in the lane's environment, or
|
|
38
|
+
* `# chant-ignore-block: TF046` above the `terraform` block holding `live`
|
|
39
|
+
* for one root, or
|
|
40
|
+
* `lint.rules: { TF046: "off" }` for a whole project.
|
|
41
|
+
*
|
|
42
|
+
* The rule is `report-only` in the audit catalog, so it is off under the
|
|
43
|
+
* `recommended` preset: terragucci switches it on and holds the product
|
|
44
|
+
* wording (chant#4561 placement).
|
|
45
|
+
*
|
|
46
|
+
* One diagnostic per root. It fires from the `terraform` block that holds the
|
|
47
|
+
* `live` block, since suppression comments anchor on top-level blocks only,
|
|
48
|
+
* and from the sidecar's `Terraform::Live` entity for a sidecar estate, where
|
|
49
|
+
* `# chant-ignore-file: TF046` in `estate.chdf.hcl` suppresses it.
|
|
50
|
+
*/
|
|
51
|
+
import { isResourceDeclarable } from "@intentius/chant/declarable";
|
|
52
|
+
import { LIVE_TYPE, TERRAFORM_TYPE, TERRAGRUNT_CONFIG_TYPE, TERRAGRUNT_GENERATE_TYPE, TERRAGRUNT_REMOTE_STATE_TYPE, } from "../../hcl/parse.js";
|
|
53
|
+
import { isRootScoped } from "./scope.js";
|
|
54
|
+
import { resolveRecordStore } from "./record-store.js";
|
|
55
|
+
/** The environment variable an emulator or test lane sets to keep the local store without a finding. */
|
|
56
|
+
export const ALLOW_LOCAL_RECORD_STORE_ENV = "CHANT_ALLOW_LOCAL_RECORD_STORE";
|
|
57
|
+
const truthy = (v) => v !== undefined && v !== "" && v !== "0" && v.toLowerCase() !== "false";
|
|
58
|
+
/** Whether the environment is a CI job. */
|
|
59
|
+
export function isCiEnvironment(env) {
|
|
60
|
+
if (truthy(env.CI))
|
|
61
|
+
return true;
|
|
62
|
+
for (const name of ["GITHUB_ACTIONS", "GITLAB_CI", "FORGEJO_ACTIONS", "GITEA_ACTIONS", "TF_BUILD"]) {
|
|
63
|
+
if (env[name]?.toLowerCase() === "true")
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
const bodyOf = (entity) => {
|
|
69
|
+
const props = entity.props;
|
|
70
|
+
return (typeof props.body === "object" && props.body !== null ? props.body : {});
|
|
71
|
+
};
|
|
72
|
+
const rootOf = (entity) => {
|
|
73
|
+
const root = entity.props.root;
|
|
74
|
+
return typeof root === "string" ? root : "";
|
|
75
|
+
};
|
|
76
|
+
/** Whether a Terragrunt block in this root writes a backend file at run time. */
|
|
77
|
+
function writesRuntimeBackend(entity) {
|
|
78
|
+
const body = bodyOf(entity);
|
|
79
|
+
switch (entity.entityType) {
|
|
80
|
+
case TERRAGRUNT_REMOTE_STATE_TYPE:
|
|
81
|
+
return body.backend !== "local";
|
|
82
|
+
case TERRAGRUNT_GENERATE_TYPE: {
|
|
83
|
+
const contents = typeof body.contents === "string" ? body.contents : "";
|
|
84
|
+
return /\bbackend\s+"(?!local")/.test(contents);
|
|
85
|
+
}
|
|
86
|
+
case TERRAGRUNT_CONFIG_TYPE:
|
|
87
|
+
return Array.isArray(body.includes) && body.includes.length > 0;
|
|
88
|
+
default:
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function liveRoots(ctx) {
|
|
93
|
+
const roots = new Map();
|
|
94
|
+
const terraform = new Map();
|
|
95
|
+
/** Per root, the key of the first `terraform` block that holds a `live` block. */
|
|
96
|
+
const holder = new Map();
|
|
97
|
+
const runtime = new Set();
|
|
98
|
+
for (const [key, entity] of ctx.entities) {
|
|
99
|
+
if (!isResourceDeclarable(entity) || !isRootScoped(entity))
|
|
100
|
+
continue;
|
|
101
|
+
const root = rootOf(entity);
|
|
102
|
+
if (entity.entityType === TERRAFORM_TYPE) {
|
|
103
|
+
const list = terraform.get(root) ?? [];
|
|
104
|
+
const body = bodyOf(entity);
|
|
105
|
+
list.push(body);
|
|
106
|
+
terraform.set(root, list);
|
|
107
|
+
if (body.live !== undefined && !holder.has(root))
|
|
108
|
+
holder.set(root, key);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (entity.entityType === LIVE_TYPE) {
|
|
112
|
+
if (entity.props.mode !== "live")
|
|
113
|
+
continue;
|
|
114
|
+
const found = roots.get(root);
|
|
115
|
+
if (found)
|
|
116
|
+
found.liveBodies.push(bodyOf(entity));
|
|
117
|
+
else
|
|
118
|
+
roots.set(root, { anchor: key, liveBodies: [bodyOf(entity)], terraformBodies: [], runtimeBackend: false });
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (writesRuntimeBackend(entity))
|
|
122
|
+
runtime.add(root);
|
|
123
|
+
}
|
|
124
|
+
for (const [root, live] of roots) {
|
|
125
|
+
live.terraformBodies = terraform.get(root) ?? [];
|
|
126
|
+
live.anchor = holder.get(root) ?? live.anchor;
|
|
127
|
+
live.runtimeBackend = runtime.has(root);
|
|
128
|
+
}
|
|
129
|
+
return roots;
|
|
130
|
+
}
|
|
131
|
+
function message(root, store) {
|
|
132
|
+
const why = store.source === "record_store"
|
|
133
|
+
? 'Its live declaration names record_store "local", a directory beside the module.'
|
|
134
|
+
: store.note
|
|
135
|
+
? `It declares no record_store, and no store is derived from its backend: ${store.note}.`
|
|
136
|
+
: store.backend
|
|
137
|
+
? `It declares no record_store, and its backend "${store.backend}" block keeps state on local disk, so choudoufu uses the local store.`
|
|
138
|
+
: "It declares no record_store and has no backend block to derive one from, so choudoufu uses the local store.";
|
|
139
|
+
return (`Live root "${root}" keeps its records in the local store, and this is a CI run. ${why} ` +
|
|
140
|
+
"A CI runner starts with an empty directory every run, so each record-backed resource is proposed " +
|
|
141
|
+
"for create again. Keep or add a backend \"s3\", \"gcs\" or \"azurerm\" block with a literal bucket " +
|
|
142
|
+
"(choudoufu derives the store from it), or declare a record_store in the live block or " +
|
|
143
|
+
`estate.chdf.hcl. A lane that uses the local store on purpose sets ${ALLOW_LOCAL_RECORD_STORE_ENV}=1.`);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* TF046 against an explicit environment. `tf046.check` passes `process.env`;
|
|
147
|
+
* tests pass their own.
|
|
148
|
+
*/
|
|
149
|
+
export function checkLocalRecordStore(ctx, env) {
|
|
150
|
+
if (!isCiEnvironment(env) || truthy(env[ALLOW_LOCAL_RECORD_STORE_ENV]))
|
|
151
|
+
return [];
|
|
152
|
+
const diagnostics = [];
|
|
153
|
+
for (const [root, live] of liveRoots(ctx)) {
|
|
154
|
+
if (live.runtimeBackend)
|
|
155
|
+
continue;
|
|
156
|
+
const store = resolveRecordStore(live.terraformBodies, live.liveBodies);
|
|
157
|
+
if (store.kind !== "local")
|
|
158
|
+
continue;
|
|
159
|
+
diagnostics.push({
|
|
160
|
+
checkId: "TF046",
|
|
161
|
+
severity: "error",
|
|
162
|
+
message: message(root, store),
|
|
163
|
+
entity: live.anchor,
|
|
164
|
+
lexicon: "terraform",
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return diagnostics;
|
|
168
|
+
}
|
|
169
|
+
export const tf046 = {
|
|
170
|
+
id: "TF046",
|
|
171
|
+
description: "Live root resolves to the local record store in a CI run",
|
|
172
|
+
check(ctx) {
|
|
173
|
+
return checkLocalRecordStore(ctx, process.env);
|
|
174
|
+
},
|
|
175
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TF047: a live root pins a registry module version the known-module catalog
|
|
3
|
+
* has no row for, or one whose row carries refusals.
|
|
4
|
+
*
|
|
5
|
+
* The catalog is choudoufu's module compatibility table, vendored in
|
|
6
|
+
* `../../module-catalog/` (chant#4560, choudoufu#2292). It has one static
|
|
7
|
+
* row per terraform-aws-modules example at one tag, measured offline in the
|
|
8
|
+
* onboarded form. A module call on a root whose binary is choudoufu (the
|
|
9
|
+
* root's `mode` is `live`) with an exact `version` is looked up there:
|
|
10
|
+
*
|
|
11
|
+
* - no row for the module, or none at the pinned version: `info`, naming the
|
|
12
|
+
* versions the static tier did measure;
|
|
13
|
+
* - at least one example at that version refused: `warning`, with each
|
|
14
|
+
* refusal ID, its site count, the examples that carry it and its
|
|
15
|
+
* `live/LIMITATIONS.md` link;
|
|
16
|
+
* - every example clear: quiet.
|
|
17
|
+
*
|
|
18
|
+
* Every message names the tier. The catalog holds the static tier only, and
|
|
19
|
+
* no figure here counts a gauntlet run (choudoufu#2292 ruling: two tiers,
|
|
20
|
+
* never mixed).
|
|
21
|
+
*
|
|
22
|
+
* A stock root (`mode: "state"`) is skipped: the table measures choudoufu.
|
|
23
|
+
* A range is TF039's finding and a missing `version` TF004's, so both are
|
|
24
|
+
* skipped here. A `//subdir` source is looked up by its module repository.
|
|
25
|
+
*
|
|
26
|
+
* Off by default: `report-only` in the audit catalog, as TF039 is.
|
|
27
|
+
* terragucci turns it on and holds the product wording (terragucci#1286).
|
|
28
|
+
*
|
|
29
|
+
* Scope: root and child modules of a live root alike.
|
|
30
|
+
*/
|
|
31
|
+
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
32
|
+
import { type ModuleCompatibility } from "../../module-catalog/index.js";
|
|
33
|
+
/** The TF047 message for one module call, or undefined when the call is clear. */
|
|
34
|
+
export declare function catalogMessage(address: string, c: ModuleCompatibility): string | undefined;
|
|
35
|
+
export declare const tf047: PostSynthCheck;
|
|
36
|
+
//# sourceMappingURL=tf047.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tf047.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/tf047.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EACV,cAAc,EAGf,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAK9B,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CA2B1F;AAED,eAAO,MAAM,KAAK,EAAE,cAkCnB,CAAC"}
|