@intentius/chant-lexicon-pulumi 0.124.97 → 0.124.99
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/dist/adopt.d.ts +0 -1
- package/dist/capability-plugin.d.ts +0 -1
- package/dist/change-set.d.ts +0 -1
- package/dist/changed-units.d.ts +0 -1
- package/dist/check-step.d.ts +0 -1
- package/dist/ci-setup.d.ts +0 -1
- package/dist/codegen/docs-cli.d.ts +0 -1
- package/dist/codegen/docs.d.ts +0 -1
- package/dist/codegen/package.d.ts +0 -1
- package/dist/composites/pulumi-adopt-op.d.ts +0 -1
- package/dist/composites/pulumi-watch-op.d.ts +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/describe-resources.d.ts +0 -1
- package/dist/drift-read.d.ts +0 -1
- package/dist/drift-record.d.ts +0 -1
- package/dist/engine-events.d.ts +0 -1
- package/dist/engine-graph.d.ts +0 -1
- package/dist/exit-codes.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/init-templates.d.ts +0 -1
- package/dist/integrity.json +2 -2
- package/dist/lint/audit-catalog.d.ts +0 -1
- package/dist/lint/post-synth/index.d.ts +0 -1
- package/dist/lint/post-synth/member-read-helpers.d.ts +0 -1
- package/dist/lint/post-synth/pul001.d.ts +0 -1
- package/dist/lint/post-synth/pul002.d.ts +0 -1
- package/dist/lint/post-synth/pul003.d.ts +0 -1
- package/dist/lint/post-synth/pul004.d.ts +0 -1
- package/dist/lint/post-synth/pul005.d.ts +0 -1
- package/dist/lint/post-synth/pul006.d.ts +0 -1
- package/dist/lint/post-synth/pul007.d.ts +0 -1
- package/dist/lint/post-synth/pul008.d.ts +0 -1
- package/dist/lint/post-synth/pul009.d.ts +0 -1
- package/dist/lint/post-synth/pul010.d.ts +0 -1
- package/dist/lint/post-synth/pul011.d.ts +0 -1
- package/dist/lint/post-synth/pul012.d.ts +0 -1
- package/dist/lint/post-synth/pul013.d.ts +0 -1
- package/dist/lint/post-synth/pul014.d.ts +0 -1
- package/dist/lint/post-synth/pul015.d.ts +0 -1
- package/dist/lint/rules/index.d.ts +0 -1
- package/dist/lint/rules/member-dir-absolute.d.ts +0 -1
- package/dist/lock-rows.d.ts +0 -1
- package/dist/lsp/completions.d.ts +0 -1
- package/dist/lsp/documents.d.ts +0 -1
- package/dist/lsp/hover.d.ts +0 -1
- package/dist/lsp/keys.d.ts +0 -1
- package/dist/lsp/object-path.d.ts +0 -1
- package/dist/lsp/yaml-cursor.d.ts +0 -1
- package/dist/manifest.json +1 -1
- package/dist/member-engine.d.ts +0 -1
- package/dist/member-outputs.d.ts +0 -1
- package/dist/op/activities/index.d.ts +0 -1
- package/dist/op/activities/pulumi-adopt.d.ts +0 -1
- package/dist/op/activities/pulumi.d.ts +0 -1
- package/dist/op/activity-contracts.d.ts +0 -1
- package/dist/op/builders.d.ts +0 -1
- package/dist/package-cli.d.ts +0 -1
- package/dist/plan-shape.d.ts +0 -1
- package/dist/planned-output-changes.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plunge-timings.d.ts +0 -1
- package/dist/preview-tips.d.ts +0 -1
- package/dist/pulumi-up.d.ts +0 -1
- package/dist/release-copy.d.ts +0 -1
- package/dist/review-stack.d.ts +0 -1
- package/dist/run.d.ts +0 -1
- package/dist/serializer.d.ts +0 -1
- package/dist/stack-export-snapshot.d.ts +0 -1
- package/dist/stack-ops.d.ts +0 -1
- package/dist/stack-outputs.d.ts +0 -1
- package/dist/stack-references.d.ts +0 -1
- package/dist/trace-facts.d.ts +0 -1
- package/dist/values.d.ts +0 -1
- package/dist/workspace-member.d.ts +0 -1
- package/package.json +3 -4
- package/dist/adopt.d.ts.map +0 -1
- package/dist/capability-plugin.d.ts.map +0 -1
- package/dist/change-set.d.ts.map +0 -1
- package/dist/changed-units.d.ts.map +0 -1
- package/dist/check-step.d.ts.map +0 -1
- package/dist/ci-setup.d.ts.map +0 -1
- package/dist/codegen/docs-cli.d.ts.map +0 -1
- package/dist/codegen/docs.d.ts.map +0 -1
- package/dist/codegen/package.d.ts.map +0 -1
- package/dist/composites/pulumi-adopt-op.d.ts.map +0 -1
- package/dist/composites/pulumi-watch-op.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/describe-resources.d.ts.map +0 -1
- package/dist/drift-read.d.ts.map +0 -1
- package/dist/drift-record.d.ts.map +0 -1
- package/dist/engine-events.d.ts.map +0 -1
- package/dist/engine-graph.d.ts.map +0 -1
- package/dist/exit-codes.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/init-templates.d.ts.map +0 -1
- package/dist/lint/audit-catalog.d.ts.map +0 -1
- package/dist/lint/post-synth/index.d.ts.map +0 -1
- package/dist/lint/post-synth/member-read-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/pul001.d.ts.map +0 -1
- package/dist/lint/post-synth/pul002.d.ts.map +0 -1
- package/dist/lint/post-synth/pul003.d.ts.map +0 -1
- package/dist/lint/post-synth/pul004.d.ts.map +0 -1
- package/dist/lint/post-synth/pul005.d.ts.map +0 -1
- package/dist/lint/post-synth/pul006.d.ts.map +0 -1
- package/dist/lint/post-synth/pul007.d.ts.map +0 -1
- package/dist/lint/post-synth/pul008.d.ts.map +0 -1
- package/dist/lint/post-synth/pul009.d.ts.map +0 -1
- package/dist/lint/post-synth/pul010.d.ts.map +0 -1
- package/dist/lint/post-synth/pul011.d.ts.map +0 -1
- package/dist/lint/post-synth/pul012.d.ts.map +0 -1
- package/dist/lint/post-synth/pul013.d.ts.map +0 -1
- package/dist/lint/post-synth/pul014.d.ts.map +0 -1
- package/dist/lint/post-synth/pul015.d.ts.map +0 -1
- package/dist/lint/rules/index.d.ts.map +0 -1
- package/dist/lint/rules/member-dir-absolute.d.ts.map +0 -1
- package/dist/lock-rows.d.ts.map +0 -1
- package/dist/lsp/completions.d.ts.map +0 -1
- package/dist/lsp/documents.d.ts.map +0 -1
- package/dist/lsp/hover.d.ts.map +0 -1
- package/dist/lsp/keys.d.ts.map +0 -1
- package/dist/lsp/object-path.d.ts.map +0 -1
- package/dist/lsp/yaml-cursor.d.ts.map +0 -1
- package/dist/member-engine.d.ts.map +0 -1
- package/dist/member-outputs.d.ts.map +0 -1
- package/dist/op/activities/index.d.ts.map +0 -1
- package/dist/op/activities/pulumi-adopt.d.ts.map +0 -1
- package/dist/op/activities/pulumi.d.ts.map +0 -1
- package/dist/op/activity-contracts.d.ts.map +0 -1
- package/dist/op/builders.d.ts.map +0 -1
- package/dist/package-cli.d.ts.map +0 -1
- package/dist/plan-shape.d.ts.map +0 -1
- package/dist/planned-output-changes.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plunge-timings.d.ts.map +0 -1
- package/dist/preview-tips.d.ts.map +0 -1
- package/dist/pulumi-up.d.ts.map +0 -1
- package/dist/release-copy.d.ts.map +0 -1
- package/dist/review-stack.d.ts.map +0 -1
- package/dist/run.d.ts.map +0 -1
- package/dist/serializer.d.ts.map +0 -1
- package/dist/stack-export-snapshot.d.ts.map +0 -1
- package/dist/stack-ops.d.ts.map +0 -1
- package/dist/stack-outputs.d.ts.map +0 -1
- package/dist/stack-references.d.ts.map +0 -1
- package/dist/trace-facts.d.ts.map +0 -1
- package/dist/values.d.ts.map +0 -1
- package/dist/workspace-member.d.ts.map +0 -1
- package/src/adopt.ts +0 -202
- package/src/capability-plugin.ts +0 -34
- package/src/change-set.test.ts +0 -245
- package/src/change-set.ts +0 -508
- package/src/changed-units.test.ts +0 -87
- package/src/changed-units.ts +0 -96
- package/src/check-step.test.ts +0 -191
- package/src/check-step.ts +0 -316
- package/src/ci-setup.test.ts +0 -234
- package/src/ci-setup.ts +0 -224
- package/src/codegen/docs-cli.ts +0 -4
- package/src/codegen/docs.ts +0 -58
- package/src/codegen/package.ts +0 -63
- package/src/composites/pulumi-adopt-op.test.ts +0 -258
- package/src/composites/pulumi-adopt-op.ts +0 -193
- package/src/composites/pulumi-watch-op.test.ts +0 -42
- package/src/composites/pulumi-watch-op.ts +0 -85
- package/src/config.ts +0 -43
- package/src/describe-resources.test.ts +0 -112
- package/src/describe-resources.ts +0 -118
- package/src/drift-read.test.ts +0 -178
- package/src/drift-read.ts +0 -94
- package/src/drift-record.test.ts +0 -197
- package/src/drift-record.ts +0 -326
- package/src/engine-events.test.ts +0 -160
- package/src/engine-events.ts +0 -395
- package/src/engine-graph.test.ts +0 -141
- package/src/engine-graph.ts +0 -149
- package/src/exit-codes.test.ts +0 -21
- package/src/exit-codes.ts +0 -71
- package/src/index.ts +0 -139
- package/src/init-templates.ts +0 -85
- package/src/lint/audit-catalog.test.ts +0 -33
- package/src/lint/audit-catalog.ts +0 -174
- package/src/lint/post-synth/index.ts +0 -35
- package/src/lint/post-synth/member-read-helpers.ts +0 -122
- package/src/lint/post-synth/post-synth.test.ts +0 -245
- package/src/lint/post-synth/pul001.ts +0 -38
- package/src/lint/post-synth/pul002.ts +0 -38
- package/src/lint/post-synth/pul003.ts +0 -43
- package/src/lint/post-synth/pul004.ts +0 -32
- package/src/lint/post-synth/pul005.ts +0 -31
- package/src/lint/post-synth/pul006.ts +0 -31
- package/src/lint/post-synth/pul007.ts +0 -35
- package/src/lint/post-synth/pul008.ts +0 -35
- package/src/lint/post-synth/pul009.ts +0 -32
- package/src/lint/post-synth/pul010.ts +0 -42
- package/src/lint/post-synth/pul011.ts +0 -38
- package/src/lint/post-synth/pul012.ts +0 -35
- package/src/lint/post-synth/pul013.ts +0 -35
- package/src/lint/post-synth/pul014.ts +0 -32
- package/src/lint/post-synth/pul015.ts +0 -39
- package/src/lint/rules/index.ts +0 -7
- package/src/lint/rules/member-dir-absolute.test.ts +0 -37
- package/src/lint/rules/member-dir-absolute.ts +0 -83
- package/src/lock-rows.test.ts +0 -60
- package/src/lock-rows.ts +0 -56
- package/src/lsp/completions.test.ts +0 -69
- package/src/lsp/completions.ts +0 -119
- package/src/lsp/documents.ts +0 -48
- package/src/lsp/hover.test.ts +0 -56
- package/src/lsp/hover.ts +0 -83
- package/src/lsp/keys.ts +0 -169
- package/src/lsp/object-path.ts +0 -71
- package/src/lsp/yaml-cursor.ts +0 -85
- package/src/member-engine.test.ts +0 -112
- package/src/member-engine.ts +0 -97
- package/src/member-outputs.test.ts +0 -339
- package/src/member-outputs.ts +0 -157
- package/src/op/activities/index.ts +0 -36
- package/src/op/activities/pulumi-adopt.ts +0 -345
- package/src/op/activities/pulumi.ts +0 -136
- package/src/op/activity-contracts.ts +0 -129
- package/src/op/builders.ts +0 -67
- package/src/package-cli.ts +0 -14
- package/src/plan-shape.test.ts +0 -91
- package/src/plan-shape.ts +0 -105
- package/src/planned-output-changes.test.ts +0 -85
- package/src/planned-output-changes.ts +0 -141
- package/src/plugin.test.ts +0 -96
- package/src/plugin.ts +0 -272
- package/src/plunge-timings.test.ts +0 -241
- package/src/plunge-timings.ts +0 -115
- package/src/plunge-up-failed.test.ts +0 -54
- package/src/pr-note.test.ts +0 -87
- package/src/preview-generated.test.ts +0 -124
- package/src/preview-tips.test.ts +0 -134
- package/src/preview-tips.ts +0 -128
- package/src/pulumi-up.test.ts +0 -581
- package/src/pulumi-up.ts +0 -1102
- package/src/pulumi-urn-node.test.ts +0 -94
- package/src/release-copy.test.ts +0 -162
- package/src/release-copy.ts +0 -223
- package/src/review-stack.test.ts +0 -254
- package/src/review-stack.ts +0 -266
- package/src/run-plan-flags.test.ts +0 -53
- package/src/run.test.ts +0 -540
- package/src/run.ts +0 -1129
- package/src/serializer.test.ts +0 -9
- package/src/serializer.ts +0 -15
- package/src/skills/chant-pulumi-plunge.md +0 -51
- package/src/skills/chant-pulumi-stack-export.md +0 -54
- package/src/skills/chant-pulumi.md +0 -83
- package/src/stack-export-snapshot.test.ts +0 -192
- package/src/stack-export-snapshot.ts +0 -312
- package/src/stack-ops.fake-binary.test.ts +0 -323
- package/src/stack-ops.test.ts +0 -511
- package/src/stack-ops.ts +0 -1082
- package/src/stack-outputs.ts +0 -66
- package/src/stack-references.test.ts +0 -96
- package/src/stack-references.ts +0 -110
- package/src/testdata/plunge-drift/README.md +0 -10
- package/src/testdata/plunge-drift/assets-drifted.ndjson +0 -3
- package/src/testdata/plunge-drift/component-unsupported.ndjson +0 -3
- package/src/testdata/plunge-drift/role-in-sync.ndjson +0 -3
- package/src/testdata/plunge-drift/settled-empty.ndjson +0 -2
- package/src/testdata/plunge-graph/Pulumi.yaml +0 -4
- package/src/testdata/plunge-graph/README.md +0 -12
- package/src/testdata/plunge-graph/engine-graph.json +0 -158
- package/src/testdata/plunge-graph/stack-export.json +0 -49
- package/src/testdata/plunge-member/Pulumi.yaml +0 -4
- package/src/testdata/plunge-member/README.md +0 -3
- package/src/testdata/plunge-member/stack-export.json +0 -480
- package/src/testdata/plunge-outputs/Pulumi.yaml +0 -9
- package/src/testdata/plunge-outputs/README.md +0 -7
- package/src/testdata/plunge-outputs/stack-export.json +0 -2003
- package/src/testdata/plunge-outputs/stack-output.json +0 -19
- package/src/testdata/pulumi-member/Pulumi.yaml +0 -2
- package/src/testdata/pulumi-member/README.md +0 -50
- package/src/testdata/pulumi-member/recording/Pulumi.dev.yaml +0 -19
- package/src/testdata/pulumi-member/recording/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-member/recording/index.js +0 -47
- package/src/testdata/pulumi-member/recording/package-lock.json +0 -2707
- package/src/testdata/pulumi-member/recording/package.json +0 -9
- package/src/testdata/pulumi-member/stack-export.json +0 -746
- package/src/testdata/pulumi-outputs/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-outputs/README.md +0 -9
- package/src/testdata/pulumi-outputs/preview-replaced.json +0 -2894
- package/src/testdata/pulumi-outputs/preview-settled.json +0 -2894
- package/src/testdata/pulumi-outputs/stack-export.json +0 -1919
- package/src/testdata/pulumi-outputs/stack-output.json +0 -19
- package/src/testdata/pulumi-preview/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-preview/README.md +0 -9
- package/src/testdata/pulumi-preview/preview-create.json +0 -992
- package/src/testdata/pulumi-preview/preview.json +0 -2894
- package/src/testdata/pulumi-preview/stack-export.json +0 -1919
- package/src/testdata/pulumi-refresh/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-refresh/README.md +0 -14
- package/src/testdata/pulumi-refresh/all.json +0 -3742
- package/src/testdata/pulumi-refresh/bucket-edited.json +0 -468
- package/src/testdata/pulumi-refresh/policy-deleted.json +0 -95
- package/src/testdata/pulumi-refresh/queue-edited.json +0 -250
- package/src/testdata/pulumi-refresh/role-same.json +0 -242
- package/src/testdata/pulumi-refresh/secret-edited.json +0 -247
- package/src/testdata/pulumi-refresh/stack-export.json +0 -1907
- package/src/testdata/pulumi-stream/README.md +0 -16
- package/src/testdata/pulumi-stream/preview-stream.ndjson +0 -42
- package/src/testdata/pulumi-stream/up-failed-plunge.ndjson +0 -5
- package/src/testdata/pulumi-unexported/Pulumi.yaml +0 -2
- package/src/testdata/pulumi-urn-node/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-urn-node/README.md +0 -9
- package/src/testdata/pulumi-urn-node/preview.json +0 -2894
- package/src/testdata/pulumi-urn-node/stack-export.json +0 -1919
- package/src/trace-facts.test.ts +0 -38
- package/src/trace-facts.ts +0 -83
- package/src/values.ts +0 -147
- package/src/workspace-kinds.test.ts +0 -47
- package/src/workspace-member.test.ts +0 -127
- package/src/workspace-member.ts +0 -304
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The pulumi lexicon's chant audit catalog: metadata for its post-synth
|
|
3
|
-
* checks, contributed through `pulumiPlugin.auditCatalog()` (#4494), the way
|
|
4
|
-
* the terraform lexicon contributes `terraformAuditCatalog`. A post-synth
|
|
5
|
-
* check with no entry contributes nothing to `chant audit` and fails
|
|
6
|
-
* `packages/core/src/audit/catalog.e2e.test.ts`.
|
|
7
|
-
*
|
|
8
|
-
* Every check reads the member the plugin's `buildRoots` left behind
|
|
9
|
-
* (`lastMemberReport`, `lastMemberRead`), never emitted output, so
|
|
10
|
-
* `yamlBased` is false. PUL001, PUL002 and PUL004 to PUL015 (#4510) are
|
|
11
|
-
* correctness or best-practice findings about the graph chant reads, and
|
|
12
|
-
* `report-only`: the build and the change set still run, and the fix is the
|
|
13
|
-
* stack owner's, outside chant. PUL003, secrets committed in plaintext, is
|
|
14
|
-
* the one security finding and the one `merge-worthy` entry; it cites no
|
|
15
|
-
* authority, so the catalog's authority rules do not apply to it. None
|
|
16
|
-
* carries `authority`. No other tool checks a checked-in stack export, so
|
|
17
|
-
* there is no lineage to credit.
|
|
18
|
-
*/
|
|
19
|
-
import type { RuleMeta } from "@intentius/chant/audit/catalog";
|
|
20
|
-
|
|
21
|
-
export const pulumiAuditCatalog: Record<string, RuleMeta> = {
|
|
22
|
-
PUL001: {
|
|
23
|
-
id: "PUL001",
|
|
24
|
-
tier: "report-only",
|
|
25
|
-
fixKind: "guidance",
|
|
26
|
-
category: "correctness",
|
|
27
|
-
title: "Pulumi member has no readable stack-export.json, so it has no nodes in the graph",
|
|
28
|
-
remediation:
|
|
29
|
-
"Run `pulumi stack export --file stack-export.json` in the member's directory (beside Pulumi.yaml) " +
|
|
30
|
-
"and check the file in, so the graph can link to the member's resources and drift records land on nodes.",
|
|
31
|
-
yamlBased: false,
|
|
32
|
-
},
|
|
33
|
-
PUL002: {
|
|
34
|
-
id: "PUL002",
|
|
35
|
-
tier: "report-only",
|
|
36
|
-
fixKind: "guidance",
|
|
37
|
-
category: "correctness",
|
|
38
|
-
title: "Pulumi member's stack export records pending operations from an interrupted update",
|
|
39
|
-
remediation:
|
|
40
|
-
"Resolve the pending operations with `pulumi refresh` (or `pulumi stack export`, edit, " +
|
|
41
|
-
"`pulumi stack import`), then export the stack again and check in the new stack-export.json.",
|
|
42
|
-
yamlBased: false,
|
|
43
|
-
},
|
|
44
|
-
PUL003: {
|
|
45
|
-
id: "PUL003",
|
|
46
|
-
tier: "merge-worthy",
|
|
47
|
-
fixKind: "guidance",
|
|
48
|
-
category: "security",
|
|
49
|
-
title: "Pulumi member's stack export holds secret values in plaintext",
|
|
50
|
-
remediation:
|
|
51
|
-
"Export the stack again without --show-secrets (`pulumi stack export --file stack-export.json`), commit that file, and rotate every secret the plaintext export exposed in the repository's history.",
|
|
52
|
-
yamlBased: false,
|
|
53
|
-
},
|
|
54
|
-
PUL004: {
|
|
55
|
-
id: "PUL004",
|
|
56
|
-
tier: "report-only",
|
|
57
|
-
fixKind: "guidance",
|
|
58
|
-
category: "correctness",
|
|
59
|
-
title: "Pulumi member's stack export holds replaced resources whose delete failed",
|
|
60
|
-
remediation:
|
|
61
|
-
"Run `pulumi up` so Pulumi retries the pending delete, then export the stack again and check in the new stack-export.json.",
|
|
62
|
-
yamlBased: false,
|
|
63
|
-
},
|
|
64
|
-
PUL005: {
|
|
65
|
-
id: "PUL005",
|
|
66
|
-
tier: "report-only",
|
|
67
|
-
fixKind: "guidance",
|
|
68
|
-
category: "correctness",
|
|
69
|
-
title: "Pulumi member's stack export holds resources deleted for a replacement that was never created",
|
|
70
|
-
remediation:
|
|
71
|
-
"Run `pulumi up` to finish the replacement, then export the stack again and check in the new stack-export.json.",
|
|
72
|
-
yamlBased: false,
|
|
73
|
-
},
|
|
74
|
-
PUL006: {
|
|
75
|
-
id: "PUL006",
|
|
76
|
-
tier: "report-only",
|
|
77
|
-
fixKind: "guidance",
|
|
78
|
-
category: "best-practice",
|
|
79
|
-
title: "Pulumi member's stack export holds tainted resources the next update replaces",
|
|
80
|
-
remediation:
|
|
81
|
-
"Expect the replacement in the member's preview, or clear the mark with `pulumi state untaint <urn>` and export again.",
|
|
82
|
-
yamlBased: false,
|
|
83
|
-
},
|
|
84
|
-
PUL007: {
|
|
85
|
-
id: "PUL007",
|
|
86
|
-
tier: "report-only",
|
|
87
|
-
fixKind: "guidance",
|
|
88
|
-
category: "correctness",
|
|
89
|
-
title: "pulumi.member.stack names a stack other than the one the stack export was taken from",
|
|
90
|
-
remediation:
|
|
91
|
-
"Export the configured stack (`pulumi stack export --stack <name> --file stack-export.json`), or set pulumi.member.stack to the stack the export names.",
|
|
92
|
-
yamlBased: false,
|
|
93
|
-
},
|
|
94
|
-
PUL008: {
|
|
95
|
-
id: "PUL008",
|
|
96
|
-
tier: "report-only",
|
|
97
|
-
fixKind: "guidance",
|
|
98
|
-
category: "correctness",
|
|
99
|
-
title: "Pulumi member's stack export names more than one stack or project",
|
|
100
|
-
remediation:
|
|
101
|
-
"Replace stack-export.json with one `pulumi stack export` of the member's stack.",
|
|
102
|
-
yamlBased: false,
|
|
103
|
-
},
|
|
104
|
-
PUL009: {
|
|
105
|
-
id: "PUL009",
|
|
106
|
-
tier: "report-only",
|
|
107
|
-
fixKind: "guidance",
|
|
108
|
-
category: "correctness",
|
|
109
|
-
title: "Pulumi member's stack export belongs to a project other than the one Pulumi.yaml names",
|
|
110
|
-
remediation:
|
|
111
|
-
"Export this member's own stack again from the directory that holds its Pulumi.yaml, and check in that file.",
|
|
112
|
-
yamlBased: false,
|
|
113
|
-
},
|
|
114
|
-
PUL010: {
|
|
115
|
-
id: "PUL010",
|
|
116
|
-
tier: "report-only",
|
|
117
|
-
fixKind: "guidance",
|
|
118
|
-
category: "correctness",
|
|
119
|
-
title: "A resource in the Pulumi member's stack export names a parent or dependency the export does not hold",
|
|
120
|
-
remediation:
|
|
121
|
-
"Replace stack-export.json with a fresh `pulumi stack export`; an export Pulumi wrote holds every parent and dependency it names.",
|
|
122
|
-
yamlBased: false,
|
|
123
|
-
},
|
|
124
|
-
PUL011: {
|
|
125
|
-
id: "PUL011",
|
|
126
|
-
tier: "report-only",
|
|
127
|
-
fixKind: "guidance",
|
|
128
|
-
category: "correctness",
|
|
129
|
-
title: "Two live resources in the Pulumi member's stack export share a URN",
|
|
130
|
-
remediation:
|
|
131
|
-
"Replace stack-export.json with a fresh `pulumi stack export` instead of a merged or edited one.",
|
|
132
|
-
yamlBased: false,
|
|
133
|
-
},
|
|
134
|
-
PUL012: {
|
|
135
|
-
id: "PUL012",
|
|
136
|
-
tier: "report-only",
|
|
137
|
-
fixKind: "guidance",
|
|
138
|
-
category: "best-practice",
|
|
139
|
-
title: "Pulumi member's stack export holds resources the stack reads and does not manage",
|
|
140
|
-
remediation:
|
|
141
|
-
"Nothing to fix in the member: read drift on these nodes as another owner's changes, and look for their owner's member in the workspace.",
|
|
142
|
-
yamlBased: false,
|
|
143
|
-
},
|
|
144
|
-
PUL013: {
|
|
145
|
-
id: "PUL013",
|
|
146
|
-
tier: "report-only",
|
|
147
|
-
fixKind: "guidance",
|
|
148
|
-
category: "correctness",
|
|
149
|
-
title: "Pulumi member's stack export has a deployment version other than 3",
|
|
150
|
-
remediation:
|
|
151
|
-
"Export the stack with the Pulumi CLI (`pulumi stack export --file stack-export.json`), which writes version 3.",
|
|
152
|
-
yamlBased: false,
|
|
153
|
-
},
|
|
154
|
-
PUL014: {
|
|
155
|
-
id: "PUL014",
|
|
156
|
-
tier: "report-only",
|
|
157
|
-
fixKind: "guidance",
|
|
158
|
-
category: "best-practice",
|
|
159
|
-
title: "Pulumi member's stack export holds no resources",
|
|
160
|
-
remediation:
|
|
161
|
-
"If the stack has been deployed, export it again after `pulumi up`; if it is empty on purpose, nothing to do.",
|
|
162
|
-
yamlBased: false,
|
|
163
|
-
},
|
|
164
|
-
PUL015: {
|
|
165
|
-
id: "PUL015",
|
|
166
|
-
tier: "report-only",
|
|
167
|
-
fixKind: "guidance",
|
|
168
|
-
category: "correctness",
|
|
169
|
-
title: "pulumi.member.engine says pulumi, but Pulumi.yaml names a plunge backend",
|
|
170
|
-
remediation:
|
|
171
|
-
"Remove `engine` from pulumi.member so the backend URL decides, or set it to \"plunge\".",
|
|
172
|
-
yamlBased: false,
|
|
173
|
-
},
|
|
174
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Code generated by chant generate. DO NOT EDIT.
|
|
2
|
-
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
3
|
-
import { pul001 } from "./pul001";
|
|
4
|
-
import { pul002 } from "./pul002";
|
|
5
|
-
import { pul003 } from "./pul003";
|
|
6
|
-
import { pul004 } from "./pul004";
|
|
7
|
-
import { pul005 } from "./pul005";
|
|
8
|
-
import { pul006 } from "./pul006";
|
|
9
|
-
import { pul007 } from "./pul007";
|
|
10
|
-
import { pul008 } from "./pul008";
|
|
11
|
-
import { pul009 } from "./pul009";
|
|
12
|
-
import { pul010 } from "./pul010";
|
|
13
|
-
import { pul011 } from "./pul011";
|
|
14
|
-
import { pul012 } from "./pul012";
|
|
15
|
-
import { pul013 } from "./pul013";
|
|
16
|
-
import { pul014 } from "./pul014";
|
|
17
|
-
import { pul015 } from "./pul015";
|
|
18
|
-
|
|
19
|
-
export const postSynthChecks: PostSynthCheck[] = [
|
|
20
|
-
pul001,
|
|
21
|
-
pul002,
|
|
22
|
-
pul003,
|
|
23
|
-
pul004,
|
|
24
|
-
pul005,
|
|
25
|
-
pul006,
|
|
26
|
-
pul007,
|
|
27
|
-
pul008,
|
|
28
|
-
pul009,
|
|
29
|
-
pul010,
|
|
30
|
-
pul011,
|
|
31
|
-
pul012,
|
|
32
|
-
pul013,
|
|
33
|
-
pul014,
|
|
34
|
-
pul015,
|
|
35
|
-
];
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What PUL003 to PUL015 share: the member read the plugin's `buildRoots`
|
|
3
|
-
* left behind (`lastMemberRead`, `../../workspace-member.ts`) and the
|
|
4
|
-
* resources of its checked-in `pulumi stack export`.
|
|
5
|
-
*
|
|
6
|
-
* The checks read the export, not the build's output: this lexicon's
|
|
7
|
-
* serializer writes `{}`, and the export is the only thing a pulumi member
|
|
8
|
-
* contributes to a build. Each check is silent in a build that read no
|
|
9
|
-
* member, and in one whose export did not read (PUL001 reports that).
|
|
10
|
-
*
|
|
11
|
-
* The export fields read here are `apitype.ResourceV3`'s: `urn`, `type`,
|
|
12
|
-
* `parent`, `dependencies`, `inputs`, `outputs`, `external`, `delete`,
|
|
13
|
-
* `pendingReplacement` and `taint`. Nothing here exports no check, so the
|
|
14
|
-
* barrel generator skips the file and `chant dev check-lexicon` does not count
|
|
15
|
-
* it (`-helpers.ts`).
|
|
16
|
-
*/
|
|
17
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
18
|
-
import { join } from "node:path";
|
|
19
|
-
import type { PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
20
|
-
import type { Severity } from "@intentius/chant/lint/rule";
|
|
21
|
-
import { parsePulumiUrn, pulumiNodeKey } from "@intentius/chant/pulumi-urn";
|
|
22
|
-
import { parseYAML } from "@intentius/chant/yaml";
|
|
23
|
-
import { isObject, PULUMI_SECRET_SIG, PULUMI_SIG_KEY } from "../../values";
|
|
24
|
-
import { lastMemberRead, type PulumiMemberRead } from "../../workspace-member";
|
|
25
|
-
|
|
26
|
-
/** One resource of the export, with the fields the checks read. */
|
|
27
|
-
export interface ExportResource {
|
|
28
|
-
urn: string;
|
|
29
|
-
type: string;
|
|
30
|
-
parent?: unknown;
|
|
31
|
-
dependencies?: unknown;
|
|
32
|
-
inputs?: unknown;
|
|
33
|
-
outputs?: unknown;
|
|
34
|
-
external?: unknown;
|
|
35
|
-
delete?: unknown;
|
|
36
|
-
pendingReplacement?: unknown;
|
|
37
|
-
taint?: unknown;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** The member read and its export's resources, or undefined when no member was read or its export did not read. */
|
|
41
|
-
export function memberExport(): { read: PulumiMemberRead; doc: Record<string, unknown>; resources: ExportResource[] } | undefined {
|
|
42
|
-
const read = lastMemberRead();
|
|
43
|
-
if (!read || !isObject(read.doc)) return undefined;
|
|
44
|
-
const deployment = isObject(read.doc.deployment) ? read.doc.deployment : undefined;
|
|
45
|
-
const list = deployment && Array.isArray(deployment.resources) ? deployment.resources : [];
|
|
46
|
-
const resources = list.filter(
|
|
47
|
-
(r): r is ExportResource => isObject(r) && typeof r.urn === "string" && typeof r.type === "string",
|
|
48
|
-
);
|
|
49
|
-
return { read, doc: read.doc, resources };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** The node a resource lands on (`<label>/<urn tail>`), or its URN when it has none. */
|
|
53
|
-
export function entityOf(read: PulumiMemberRead, urn: string): string {
|
|
54
|
-
const tail = pulumiNodeKey(urn);
|
|
55
|
-
return tail === null ? urn : `${read.label}/${tail}`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** A pulumi diagnostic about one member. */
|
|
59
|
-
export function finding(checkId: string, severity: Severity, message: string, entity?: string): PostSynthDiagnostic {
|
|
60
|
-
return { checkId, severity, message, lexicon: "pulumi", ...(entity ? { entity } : {}) };
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** The resources whose export entry sets `field` to true. */
|
|
64
|
-
export function flagged(resources: readonly ExportResource[], field: "external" | "delete" | "pendingReplacement" | "taint"): ExportResource[] {
|
|
65
|
-
return resources.filter((r) => r[field] === true);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* The paths under `inputs` and `outputs` that hold a secret in plaintext: a
|
|
70
|
-
* secret envelope (`{ [PULUMI_SIG_KEY]: PULUMI_SECRET_SIG, ... }`) with a
|
|
71
|
-
* `plaintext` field. `pulumi stack export` writes `ciphertext` there;
|
|
72
|
-
* `pulumi stack export --show-secrets` writes `plaintext`.
|
|
73
|
-
*/
|
|
74
|
-
export function plaintextSecretPaths(resource: ExportResource): string[] {
|
|
75
|
-
const out: string[] = [];
|
|
76
|
-
const walk = (v: unknown, path: string) => {
|
|
77
|
-
if (Array.isArray(v)) {
|
|
78
|
-
v.forEach((x, i) => walk(x, `${path}[${i}]`));
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (!isObject(v)) return;
|
|
82
|
-
if (v[PULUMI_SIG_KEY] === PULUMI_SECRET_SIG) {
|
|
83
|
-
if ("plaintext" in v) out.push(path);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
for (const [k, x] of Object.entries(v)) walk(x, `${path}.${k}`);
|
|
87
|
-
};
|
|
88
|
-
walk(resource.inputs, "inputs");
|
|
89
|
-
walk(resource.outputs, "outputs");
|
|
90
|
-
return out;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/** The distinct stacks and projects the export's URNs name. */
|
|
94
|
-
export function urnScopes(resources: readonly ExportResource[]): { stacks: string[]; projects: string[] } {
|
|
95
|
-
const stacks = new Set<string>();
|
|
96
|
-
const projects = new Set<string>();
|
|
97
|
-
for (const r of resources) {
|
|
98
|
-
const parsed = parsePulumiUrn(r.urn);
|
|
99
|
-
if (!parsed) continue;
|
|
100
|
-
stacks.add(parsed.stack);
|
|
101
|
-
projects.add(parsed.project);
|
|
102
|
-
}
|
|
103
|
-
return { stacks: [...stacks].sort(), projects: [...projects].sort() };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** `name` from the member's `Pulumi.yaml`, or undefined when it has none or does not parse. */
|
|
107
|
-
export function pulumiYamlName(dir: string): string | undefined {
|
|
108
|
-
const file = join(dir, "Pulumi.yaml");
|
|
109
|
-
if (!existsSync(file)) return undefined;
|
|
110
|
-
try {
|
|
111
|
-
const doc = parseYAML(readFileSync(file, "utf-8")) as { name?: unknown };
|
|
112
|
-
return typeof doc?.name === "string" && doc.name.length > 0 ? doc.name : undefined;
|
|
113
|
-
} catch {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** A list for a message: the first few, then how many more. */
|
|
119
|
-
export function listed(items: readonly string[], max = 3): string {
|
|
120
|
-
const shown = items.slice(0, max).join(", ");
|
|
121
|
-
return items.length > max ? `${shown} and ${items.length - max} more` : shown;
|
|
122
|
-
}
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
5
|
-
import type { PostSynthContext } from "@intentius/chant/lint/post-synth";
|
|
6
|
-
import { PULUMI_SECRET_SIG, PULUMI_SIG_KEY } from "../../values";
|
|
7
|
-
import { setLastMemberRead, setLastMemberReport } from "../../workspace-member";
|
|
8
|
-
import { postSynthChecks } from "./index";
|
|
9
|
-
import { pul001 } from "./pul001";
|
|
10
|
-
import { pul002 } from "./pul002";
|
|
11
|
-
import { pul003 } from "./pul003";
|
|
12
|
-
import { pul004 } from "./pul004";
|
|
13
|
-
import { pul005 } from "./pul005";
|
|
14
|
-
import { pul006 } from "./pul006";
|
|
15
|
-
import { pul007 } from "./pul007";
|
|
16
|
-
import { pul008 } from "./pul008";
|
|
17
|
-
import { pul009 } from "./pul009";
|
|
18
|
-
import { pul010 } from "./pul010";
|
|
19
|
-
import { pul011 } from "./pul011";
|
|
20
|
-
import { pul012 } from "./pul012";
|
|
21
|
-
import { pul013 } from "./pul013";
|
|
22
|
-
import { pul014 } from "./pul014";
|
|
23
|
-
import { pul015 } from "./pul015";
|
|
24
|
-
|
|
25
|
-
const ctx = { outputs: new Map(), entities: new Map() } as unknown as PostSynthContext;
|
|
26
|
-
|
|
27
|
-
afterEach(() => {
|
|
28
|
-
vi.unstubAllEnvs();
|
|
29
|
-
setLastMemberReport(undefined);
|
|
30
|
-
setLastMemberRead(undefined);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const testdata = join(import.meta.dirname, "..", "..", "testdata");
|
|
34
|
-
/** testdata/pulumi-member: Pulumi.yaml names project `app`, no backend. */
|
|
35
|
-
const stockDir = join(testdata, "pulumi-member");
|
|
36
|
-
/** testdata/plunge-member: Pulumi.yaml names project `site` on `plunge+file://`. */
|
|
37
|
-
const plungeDir = join(testdata, "plunge-member");
|
|
38
|
-
|
|
39
|
-
const STACK = "urn:pulumi:dev::app::pulumi:pulumi:Stack::app-dev";
|
|
40
|
-
const PROVIDER = "urn:pulumi:dev::app::pulumi:providers:aws::default";
|
|
41
|
-
const BUCKET = "urn:pulumi:dev::app::aws:s3/bucketV2:BucketV2::assets";
|
|
42
|
-
const ROLE = "urn:pulumi:dev::app::aws:iam/role:Role::web";
|
|
43
|
-
|
|
44
|
-
const stackRes = { urn: STACK, type: "pulumi:pulumi:Stack" };
|
|
45
|
-
const providerRes = { urn: PROVIDER, type: "pulumi:providers:aws" };
|
|
46
|
-
const bucket = (extra: Record<string, unknown> = {}) => ({ urn: BUCKET, type: "aws:s3/bucketV2:BucketV2", parent: STACK, ...extra });
|
|
47
|
-
const role = (extra: Record<string, unknown> = {}) => ({ urn: ROLE, type: "aws:iam/role:Role", parent: STACK, ...extra });
|
|
48
|
-
|
|
49
|
-
/** Leave a member read whose export holds `resources`, as `buildRoots` would. */
|
|
50
|
-
function readWith(resources: unknown[], opts: { dir?: string; stack?: string; engine?: "pulumi" | "plunge"; version?: unknown } = {}) {
|
|
51
|
-
const doc: Record<string, unknown> = { deployment: { resources } };
|
|
52
|
-
if (!("version" in opts)) doc.version = 3;
|
|
53
|
-
else if (opts.version !== undefined) doc.version = opts.version;
|
|
54
|
-
setLastMemberRead({
|
|
55
|
-
dir: opts.dir ?? stockDir,
|
|
56
|
-
label: "infra",
|
|
57
|
-
...(opts.stack ? { stack: opts.stack } : {}),
|
|
58
|
-
...(opts.engine ? { engine: opts.engine } : {}),
|
|
59
|
-
doc,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const clean = () => readWith([stackRes, providerRes, bucket(), role({ dependencies: [BUCKET] })]);
|
|
64
|
-
const memberChecks = [pul003, pul004, pul005, pul006, pul007, pul008, pul009, pul010, pul011, pul012, pul013, pul014, pul015];
|
|
65
|
-
|
|
66
|
-
describe("pulumi post-synth checks", () => {
|
|
67
|
-
test("the barrel lists both", () => {
|
|
68
|
-
expect(postSynthChecks.map((c) => c.id)).toEqual(Array.from({ length: 15 }, (_, i) => `PUL${String(i + 1).padStart(3, "0")}`));
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test("every check stays silent in a build that read no member", () => {
|
|
72
|
-
setLastMemberReport(undefined);
|
|
73
|
-
for (const check of postSynthChecks) expect(check.check(ctx), check.id).toEqual([]);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test("PUL001 reports a member read with no export, with the reason", () => {
|
|
77
|
-
setLastMemberReport({ objects: 0, exported: false, reason: "no stack-export.json in the member" });
|
|
78
|
-
const diags = pul001.check(ctx);
|
|
79
|
-
expect(diags).toHaveLength(1);
|
|
80
|
-
expect(diags[0].checkId).toBe("PUL001");
|
|
81
|
-
expect(diags[0].severity).toBe("warning");
|
|
82
|
-
expect(diags[0].message).toContain("no stack-export.json in the member");
|
|
83
|
-
expect(diags[0].missing).toEqual({ kind: "stack-export.json", scope: "pulumi member" });
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test("PUL001 is silent for a member that was read", () => {
|
|
87
|
-
setLastMemberReport({ export: "stack-export.json", objects: 3, exported: true });
|
|
88
|
-
expect(pul001.check(ctx)).toEqual([]);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("PUL002 reports pending operations and is silent without them", () => {
|
|
92
|
-
setLastMemberReport({ export: "stack-export.json", objects: 3, exported: true, pendingOperations: 2 });
|
|
93
|
-
const diags = pul002.check(ctx);
|
|
94
|
-
expect(diags).toHaveLength(1);
|
|
95
|
-
expect(diags[0].checkId).toBe("PUL002");
|
|
96
|
-
expect(diags[0].message).toContain("2 pending operation(s)");
|
|
97
|
-
|
|
98
|
-
setLastMemberReport({ export: "stack-export.json", objects: 3, exported: true });
|
|
99
|
-
expect(pul002.check(ctx)).toEqual([]);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test("PUL003 to PUL015 are silent on a clean export", () => {
|
|
103
|
-
clean();
|
|
104
|
-
for (const check of memberChecks) expect(check.check(ctx), check.id).toEqual([]);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test("PUL003 reports a plaintext secret and not a ciphertext one", () => {
|
|
108
|
-
const envelope = (field: string) => ({ [PULUMI_SIG_KEY]: PULUMI_SECRET_SIG, [field]: "\"hunter2\"" });
|
|
109
|
-
readWith([stackRes, bucket({ inputs: { tags: { token: envelope("ciphertext") } } })]);
|
|
110
|
-
expect(pul003.check(ctx)).toEqual([]);
|
|
111
|
-
readWith([stackRes, bucket({ outputs: { policy: [envelope("plaintext")] } })]);
|
|
112
|
-
const diags = pul003.check(ctx);
|
|
113
|
-
expect(diags).toHaveLength(1);
|
|
114
|
-
expect(diags[0]).toMatchObject({ checkId: "PUL003", severity: "error", entity: "infra/aws:s3/bucketV2:BucketV2::assets" });
|
|
115
|
-
expect(diags[0].message).toContain("outputs.policy[0]");
|
|
116
|
-
expect(diags[0].message).not.toContain("hunter2");
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test("PUL004, PUL005 and PUL006 report delete, pendingReplacement and taint", () => {
|
|
120
|
-
readWith([stackRes, bucket({ delete: true }), bucket(), role({ pendingReplacement: true, taint: true })]);
|
|
121
|
-
expect(pul004.check(ctx).map((d) => d.entity)).toEqual(["infra/aws:s3/bucketV2:BucketV2::assets"]);
|
|
122
|
-
expect(pul005.check(ctx).map((d) => d.entity)).toEqual(["infra/aws:iam/role:Role::web"]);
|
|
123
|
-
const taint = pul006.check(ctx);
|
|
124
|
-
expect(taint.map((d) => d.entity)).toEqual(["infra/aws:iam/role:Role::web"]);
|
|
125
|
-
expect(taint[0].severity).toBe("info");
|
|
126
|
-
// The pending-delete entry is the old object of a replacement, not a duplicate.
|
|
127
|
-
expect(pul011.check(ctx)).toEqual([]);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test("PUL007 reports a configured stack the export was not taken from", () => {
|
|
131
|
-
readWith([stackRes, bucket()], { stack: "dev" });
|
|
132
|
-
expect(pul007.check(ctx)).toEqual([]);
|
|
133
|
-
readWith([stackRes, bucket()], { stack: "prod" });
|
|
134
|
-
const diags = pul007.check(ctx);
|
|
135
|
-
expect(diags).toHaveLength(1);
|
|
136
|
-
expect(diags[0].message).toContain('"prod"');
|
|
137
|
-
expect(diags[0].message).toContain('"dev"');
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
test("PUL008 reports URNs from two stacks", () => {
|
|
141
|
-
readWith([stackRes, bucket(), { urn: "urn:pulumi:prod::app::aws:iam/role:Role::web", type: "aws:iam/role:Role" }]);
|
|
142
|
-
const diags = pul008.check(ctx);
|
|
143
|
-
expect(diags).toHaveLength(1);
|
|
144
|
-
expect(diags[0].message).toContain("stacks dev, prod");
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
test("PUL009 reports an export from a project Pulumi.yaml does not name", () => {
|
|
148
|
-
readWith([{ urn: "urn:pulumi:dev::shop::aws:iam/role:Role::web", type: "aws:iam/role:Role" }]);
|
|
149
|
-
const diags = pul009.check(ctx);
|
|
150
|
-
expect(diags).toHaveLength(1);
|
|
151
|
-
expect(diags[0].message).toContain('"shop"');
|
|
152
|
-
expect(diags[0].message).toContain('"app"');
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test("PUL010 reports a dependency the export does not hold", () => {
|
|
156
|
-
readWith([stackRes, role({ dependencies: [BUCKET] })]);
|
|
157
|
-
const diags = pul010.check(ctx);
|
|
158
|
-
expect(diags).toHaveLength(1);
|
|
159
|
-
expect(diags[0].entity).toBe("infra/aws:iam/role:Role::web");
|
|
160
|
-
expect(diags[0].message).toContain(BUCKET);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
test("PUL011 reports two live entries for one URN", () => {
|
|
164
|
-
readWith([stackRes, bucket(), bucket()]);
|
|
165
|
-
expect(pul011.check(ctx)).toHaveLength(1);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
test("PUL012 reports external resources as information", () => {
|
|
169
|
-
readWith([stackRes, providerRes, bucket({ external: true })]);
|
|
170
|
-
const diags = pul012.check(ctx);
|
|
171
|
-
expect(diags).toHaveLength(1);
|
|
172
|
-
expect(diags[0].severity).toBe("info");
|
|
173
|
-
expect(diags[0].message).toContain(BUCKET);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
test("PUL013 reports an export version other than 3, or none", () => {
|
|
177
|
-
readWith([stackRes, bucket()], { version: 2 });
|
|
178
|
-
expect(pul013.check(ctx)[0].message).toContain("version 2");
|
|
179
|
-
readWith([stackRes, bucket()], { version: undefined });
|
|
180
|
-
expect(pul013.check(ctx)[0].message).toContain("no version");
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test("PUL014 reports an export with only the stack and its providers", () => {
|
|
184
|
-
readWith([stackRes, providerRes]);
|
|
185
|
-
expect(pul014.check(ctx)).toHaveLength(1);
|
|
186
|
-
readWith([]);
|
|
187
|
-
expect(pul014.check(ctx)).toHaveLength(1);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test("PUL015 reports engine: pulumi on a plunge backend, and nothing else", () => {
|
|
191
|
-
readWith([], { dir: plungeDir, engine: "pulumi" });
|
|
192
|
-
const diags = pul015.check(ctx);
|
|
193
|
-
expect(diags).toHaveLength(1);
|
|
194
|
-
expect(diags[0].message).toContain("plunge+file://");
|
|
195
|
-
readWith([], { dir: plungeDir, engine: "plunge" });
|
|
196
|
-
expect(pul015.check(ctx)).toEqual([]);
|
|
197
|
-
readWith([], { dir: plungeDir });
|
|
198
|
-
expect(pul015.check(ctx)).toEqual([]);
|
|
199
|
-
readWith([], { dir: stockDir, engine: "plunge" });
|
|
200
|
-
expect(pul015.check(ctx)).toEqual([]);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
test("PUL015 names the source of the resolved plunge engine", () => {
|
|
204
|
-
// Pulumi.yaml
|
|
205
|
-
readWith([], { dir: plungeDir, engine: "pulumi" });
|
|
206
|
-
expect(pul015.check(ctx)[0].message).toContain("Pulumi.yaml names the plunge backend");
|
|
207
|
-
|
|
208
|
-
// PULUMI_BACKEND_URL, on a program whose Pulumi.yaml names no backend
|
|
209
|
-
vi.stubEnv("PULUMI_BACKEND_URL", "plunge+s3://bucket/state");
|
|
210
|
-
readWith([], { dir: stockDir, engine: "pulumi" });
|
|
211
|
-
const fromEnv = pul015.check(ctx);
|
|
212
|
-
expect(fromEnv).toHaveLength(1);
|
|
213
|
-
expect(fromEnv[0].message).toContain("PULUMI_BACKEND_URL names the plunge backend plunge+s3://bucket/state");
|
|
214
|
-
readWith([], { dir: stockDir, engine: "plunge" });
|
|
215
|
-
expect(pul015.check(ctx)).toEqual([]);
|
|
216
|
-
vi.stubEnv("PULUMI_BACKEND_URL", "s3://bucket/state");
|
|
217
|
-
readWith([], { dir: stockDir, engine: "pulumi" });
|
|
218
|
-
expect(pul015.check(ctx)).toEqual([]);
|
|
219
|
-
vi.unstubAllEnvs();
|
|
220
|
-
|
|
221
|
-
// plywood.yml, engine and backend
|
|
222
|
-
const root = mkdtempSync(join(tmpdir(), "pul015-"));
|
|
223
|
-
mkdirSync(join(root, ".git"));
|
|
224
|
-
const member = join(root, "infra");
|
|
225
|
-
mkdirSync(member);
|
|
226
|
-
writeFileSync(join(member, "Pulumi.yaml"), "name: app\nruntime: nodejs\n");
|
|
227
|
-
writeFileSync(join(root, "plywood.yml"), "engine: plunge\n");
|
|
228
|
-
readWith([], { dir: member, engine: "pulumi" });
|
|
229
|
-
const fromEngine = pul015.check(ctx);
|
|
230
|
-
expect(fromEngine).toHaveLength(1);
|
|
231
|
-
expect(fromEngine[0].message).toContain("plywood.yml says engine: plunge");
|
|
232
|
-
writeFileSync(join(root, "plywood.yml"), "backend: plunge+file:///state\n");
|
|
233
|
-
const fromBackend = pul015.check(ctx);
|
|
234
|
-
expect(fromBackend).toHaveLength(1);
|
|
235
|
-
expect(fromBackend[0].message).toContain("plywood.yml names the plunge backend plunge+file:///state");
|
|
236
|
-
writeFileSync(join(root, "plywood.yml"), "engine: pulumi\n");
|
|
237
|
-
expect(pul015.check(ctx)).toEqual([]);
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
test("PUL015 does not report the other direction: engine plunge on a stock backend", () => {
|
|
241
|
-
vi.stubEnv("PULUMI_BACKEND_URL", "s3://bucket/state");
|
|
242
|
-
readWith([], { dir: stockDir, engine: "plunge" });
|
|
243
|
-
expect(pul015.check(ctx)).toEqual([]);
|
|
244
|
-
});
|
|
245
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PUL001: a pulumi member was read with no graph.
|
|
3
|
-
*
|
|
4
|
-
* The member's graph is the `pulumi stack export` checked in beside
|
|
5
|
-
* `Pulumi.yaml` as `stack-export.json` (`../../workspace-member.ts`). The
|
|
6
|
-
* graph read never runs the program or `pulumi`, so a member with no export,
|
|
7
|
-
* or one that is not JSON, has no nodes at all. The build still succeeds, the
|
|
8
|
-
* change set and drift still run, and the graph silently shows an empty
|
|
9
|
-
* member: nothing links to its resources and no drift record lands on a node.
|
|
10
|
-
* This check says so at build time, with the reason the read recorded.
|
|
11
|
-
*
|
|
12
|
-
* It reads the report the plugin's `buildRoots` left for `graphMeta`
|
|
13
|
-
* (`lastMemberReport`), so it fires only in a build that read a member: a
|
|
14
|
-
* project that names the lexicon without a `pulumi.member` gets nothing.
|
|
15
|
-
*/
|
|
16
|
-
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
17
|
-
import { lastMemberReport, PULUMI_EXPORT_FILE } from "../../workspace-member";
|
|
18
|
-
|
|
19
|
-
export const pul001: PostSynthCheck = {
|
|
20
|
-
id: "PUL001",
|
|
21
|
-
description: "A pulumi member with no readable stack-export.json has no nodes in the graph",
|
|
22
|
-
|
|
23
|
-
check(_ctx: PostSynthContext): PostSynthDiagnostic[] {
|
|
24
|
-
const report = lastMemberReport();
|
|
25
|
-
if (!report || report.exported) return [];
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
checkId: "PUL001",
|
|
29
|
-
severity: "warning",
|
|
30
|
-
message:
|
|
31
|
-
`the pulumi member was read with no nodes: ${report.reason ?? `no readable ${PULUMI_EXPORT_FILE}`}. ` +
|
|
32
|
-
`Its change set and drift still run, but nothing in the graph can link to its resources.`,
|
|
33
|
-
lexicon: "pulumi",
|
|
34
|
-
missing: { kind: PULUMI_EXPORT_FILE, scope: "pulumi member" },
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PUL002: the member's stack export records pending operations.
|
|
3
|
-
*
|
|
4
|
-
* Pulumi writes a `deployment.pending_operations` entry for each step an
|
|
5
|
-
* update started and did not finish (a killed `pulumi up`, a lost runner).
|
|
6
|
-
* Until someone resolves them (`pulumi refresh`, or `pulumi stack export`,
|
|
7
|
-
* edit, `pulumi stack import`), the stack may hold a resource its state does
|
|
8
|
-
* not list, and `pulumi preview` and `pulumi refresh` warn about them on
|
|
9
|
-
* every run. chant reads the checked-in export for the graph, so an export
|
|
10
|
-
* taken in that state puts the same gap in the graph: the half-created
|
|
11
|
-
* resources have no node.
|
|
12
|
-
*
|
|
13
|
-
* A warning, not an error: the export is still read, and the fix is the
|
|
14
|
-
* stack owner's, outside chant.
|
|
15
|
-
*/
|
|
16
|
-
import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
|
|
17
|
-
import { lastMemberReport, PULUMI_EXPORT_FILE } from "../../workspace-member";
|
|
18
|
-
|
|
19
|
-
export const pul002: PostSynthCheck = {
|
|
20
|
-
id: "PUL002",
|
|
21
|
-
description: "The pulumi member's stack export records operations an interrupted update left pending",
|
|
22
|
-
|
|
23
|
-
check(_ctx: PostSynthContext): PostSynthDiagnostic[] {
|
|
24
|
-
const pending = lastMemberReport()?.pendingOperations ?? 0;
|
|
25
|
-
if (pending === 0) return [];
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
checkId: "PUL002",
|
|
29
|
-
severity: "warning",
|
|
30
|
-
message:
|
|
31
|
-
`${PULUMI_EXPORT_FILE} records ${pending} pending operation(s): an update was interrupted and the stack may hold ` +
|
|
32
|
-
`resources its state does not list, so the graph is missing them too. Resolve them with \`pulumi refresh\` ` +
|
|
33
|
-
`(or export, edit and \`pulumi stack import\`), then export the stack again.`,
|
|
34
|
-
lexicon: "pulumi",
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
},
|
|
38
|
-
};
|