@intentius/chant-lexicon-pulumi 0.124.98 → 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,339 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Pulumi engine's member outputs (#4455): a chant member's parameter
|
|
3
|
-
* planned against a Pulumi stack output, read through `pulumiOutputSource`.
|
|
4
|
-
*
|
|
5
|
-
* The estate: `records` reads `vpcId`, which the `aws` member's stack
|
|
6
|
-
* publishes. `records` is a fake step that plans its parameters the way
|
|
7
|
-
* `cfn-deploy` does (a hole when an input is not known yet). The pulumi and
|
|
8
|
-
* plunge runners are fakes that answer the fixtures in
|
|
9
|
-
* `testdata/pulumi-outputs` and `testdata/plunge-outputs`, recorded for
|
|
10
|
-
* #4475 from pulumi 3.272.0 and plunge running the plunge corpus's aws-ts
|
|
11
|
-
* program on floci (see their READMEs): `stack output --json
|
|
12
|
-
* --show-secrets=false` prints a secret output as the string `"[secret]"`,
|
|
13
|
-
* and `preview --json` plans no stack outputs, so a settled preview gives
|
|
14
|
-
* the export's. A preview with changes traces each output to the export's
|
|
15
|
-
* resources (#4635): the replaced VPC's and security group's ids, the
|
|
16
|
-
* deleted parameter's name and the deleted queue's URL are unknown, and the
|
|
17
|
-
* rest keep the export's value. No binary runs here.
|
|
18
|
-
*/
|
|
19
|
-
import { readFileSync } from "node:fs";
|
|
20
|
-
import { join } from "node:path";
|
|
21
|
-
import { describe, expect, test } from "vitest";
|
|
22
|
-
import { CapabilityRegistry, type DeployContext } from "@intentius/chant/components/capability";
|
|
23
|
-
import { registerCapabilityPlugins } from "@intentius/chant/components/capability-plugin-loader";
|
|
24
|
-
import type { CapabilityPlugin } from "@intentius/chant/components/capability-plugin";
|
|
25
|
-
import { starterCapabilityPlugin } from "@intentius/chant/components/starter-plugin";
|
|
26
|
-
import { planFanOut } from "@intentius/chant/components/fan-out";
|
|
27
|
-
import { applyPrSet, approvalOf, decidePrGate, planPrSet, readOnlyLedger, type PrPlanSet } from "@intentius/chant/components/pr-run";
|
|
28
|
-
import { memoryGateLedgerPort } from "@intentius/chant/op/gate";
|
|
29
|
-
import { computePlanDigest } from "@intentius/chant/lifecycle/plan-digest";
|
|
30
|
-
import type { DriverComponent } from "@intentius/chant/components/driver";
|
|
31
|
-
import {
|
|
32
|
-
MEMBER_OUTPUTS_KIND,
|
|
33
|
-
memberOutputsCapability,
|
|
34
|
-
memberOutputsComponent,
|
|
35
|
-
memberOutputsMemberName,
|
|
36
|
-
MemberOutputsPendingError,
|
|
37
|
-
type EngineMemberRef,
|
|
38
|
-
} from "@intentius/chant/components/verbs/member-outputs";
|
|
39
|
-
import { pulumiCapabilityPlugin } from "./capability-plugin";
|
|
40
|
-
import { pulumiMemberPlannedOutputs, pulumiOutputSource } from "./member-outputs";
|
|
41
|
-
import { previewPulumiMemberRead, pulumiMemberStackOutputs, runAllowedPlunge, runAllowedPulumi, type PulumiRunner } from "./run";
|
|
42
|
-
|
|
43
|
-
const testdata = join(import.meta.dirname, "testdata");
|
|
44
|
-
const text = (...path: string[]) => readFileSync(join(testdata, ...path), "utf-8");
|
|
45
|
-
const AWS_DIR = join(testdata, "pulumi-outputs");
|
|
46
|
-
const PLUNGE_DIR = join(testdata, "plunge-outputs");
|
|
47
|
-
const OLD = "vpc-05097b38";
|
|
48
|
-
/** What `stack output` printed, the blinded secret left out. */
|
|
49
|
-
const withoutSecret = (file: string): Record<string, unknown> =>
|
|
50
|
-
Object.fromEntries(Object.entries(JSON.parse(text(file, "stack-output.json")) as Record<string, unknown>).filter(([, v]) => v !== "[secret]"));
|
|
51
|
-
const APPLIED = withoutSecret("pulumi-outputs");
|
|
52
|
-
const PLUNGE_APPLIED = withoutSecret("plunge-outputs");
|
|
53
|
-
/** The outputs preview-replaced.json moves (#4635): the replaced VPC's and security group's ids, the deleted parameter's name, the deleted queue's URL. */
|
|
54
|
-
const MOVED = ["securityGroupId", "vpcId", "vpcParameterName", "workerQueueUrls"];
|
|
55
|
-
const KEPT = Object.fromEntries(Object.entries(APPLIED).filter(([k]) => !MOVED.includes(k)));
|
|
56
|
-
|
|
57
|
-
function fake(answer: (args: string[]) => string): { run: PulumiRunner; calls: string[][] } {
|
|
58
|
-
const calls: string[][] = [];
|
|
59
|
-
const run: PulumiRunner = async (args) => {
|
|
60
|
-
calls.push(args);
|
|
61
|
-
return { stdout: answer(args) };
|
|
62
|
-
};
|
|
63
|
-
return { run, calls };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** The aws member, as a pulumi CLI that answers `stack output` and `preview` from the fixtures. */
|
|
67
|
-
function awsCli(state: { preview: string; outputs?: string }) {
|
|
68
|
-
return fake((args) => (args[0] === "stack" ? text(state.outputs ?? "pulumi-outputs", "stack-output.json") : text("pulumi-outputs", state.preview)));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
describe("the allow-list", () => {
|
|
72
|
-
test("stack output reaches the runner only with --json and secrets blinded", async () => {
|
|
73
|
-
const { run, calls } = fake(() => "{}");
|
|
74
|
-
for (const args of [["stack", "output"], ["stack", "output", "--json", "--show-secrets"], ["stack", "output", "--json", "--show-secrets=true"], ["stack", "export"], ["stack", "select", "local"]]) {
|
|
75
|
-
await expect(runAllowedPulumi(run, args, "/tmp")).rejects.toThrow(/stack output --json --show-secrets=false/);
|
|
76
|
-
}
|
|
77
|
-
expect(calls).toEqual([]);
|
|
78
|
-
await runAllowedPulumi(run, ["stack", "output", "--json", "--show-secrets=false"], "/tmp");
|
|
79
|
-
expect(calls).toEqual([["stack", "output", "--json", "--show-secrets=false"]]);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("stack output may name its stack, and a --stack with no name, or a flag for one, is refused (#4514)", async () => {
|
|
83
|
-
const { run, calls } = fake(() => "{}");
|
|
84
|
-
for (const args of [
|
|
85
|
-
["stack", "output", "--json", "--show-secrets=false", "--stack"],
|
|
86
|
-
["stack", "output", "--json", "--show-secrets=false", "--stack", "--show-secrets"],
|
|
87
|
-
["stack", "output", "--json", "--show-secrets=false", "--stack", ""],
|
|
88
|
-
]) {
|
|
89
|
-
await expect(runAllowedPulumi(run, args, "/tmp")).rejects.toThrow(/stack output --json --show-secrets=false/);
|
|
90
|
-
await expect(runAllowedPlunge(run, args, "/tmp")).rejects.toThrow(/plunge stack output --json --show-secrets=false/);
|
|
91
|
-
}
|
|
92
|
-
expect(calls).toEqual([]);
|
|
93
|
-
await runAllowedPulumi(run, ["stack", "output", "--json", "--show-secrets=false", "--stack", "floci"], "/tmp");
|
|
94
|
-
await runAllowedPlunge(run, ["stack", "output", "--json", "--show-secrets=false", "--stack", "floci"], "/tmp");
|
|
95
|
-
expect(calls).toEqual([
|
|
96
|
-
["stack", "output", "--json", "--show-secrets=false", "--stack", "floci"],
|
|
97
|
-
["stack", "output", "--json", "--show-secrets=false", "--stack", "floci"],
|
|
98
|
-
]);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
describe("pulumiOutputSource", () => {
|
|
103
|
-
const ref: EngineMemberRef = { member: "aws", kind: "pulumi", dir: AWS_DIR, workspaceRoot: testdata };
|
|
104
|
-
const ctx: DeployContext = { env: "local", component: "aws" };
|
|
105
|
-
|
|
106
|
-
test("applied values come from pulumi stack output --json --show-secrets=false, the secret left out", async () => {
|
|
107
|
-
const cli = awsCli({ preview: "preview-settled.json" });
|
|
108
|
-
const outputs = await pulumiOutputSource({ run: cli.run }).applied(ctx, ref);
|
|
109
|
-
expect(outputs).toEqual(APPLIED);
|
|
110
|
-
expect(outputs.vpcId).toBe(OLD);
|
|
111
|
-
expect(outputs).not.toHaveProperty("dbPasswordValue");
|
|
112
|
-
// --stack (#4514): the workspace declares no stack, so the one the export's URNs name.
|
|
113
|
-
expect(cli.calls).toEqual([["stack", "output", "--json", "--show-secrets=false", "--stack", "floci"]]);
|
|
114
|
-
expect(JSON.stringify(outputs)).not.toContain("[secret]");
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("applied values come from the checked-in export when chant must not run pulumi", async () => {
|
|
118
|
-
const cli = fake(() => {
|
|
119
|
-
throw new Error("pulumi must not run");
|
|
120
|
-
});
|
|
121
|
-
// The export's stack outputs are the same values stack output printed; its secret is ciphertext, left out.
|
|
122
|
-
expect(await pulumiOutputSource({ applied: "export", run: cli.run }).applied(ctx, ref)).toEqual(APPLIED);
|
|
123
|
-
expect(cli.calls).toEqual([]);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test("planned values: a settled preview plans no stack outputs and nothing to apply, so the export's stand", async () => {
|
|
127
|
-
const cli = awsCli({ preview: "preview-settled.json" });
|
|
128
|
-
const planned = await pulumiOutputSource({ run: cli.run }).planned(ctx, ref);
|
|
129
|
-
expect(planned).toMatchObject({ known: APPLIED, unknown: [], changes: false });
|
|
130
|
-
expect(planned.planDigest).toMatch(/^jcs1-sha256:[0-9a-f]{64}$/);
|
|
131
|
-
expect(cli.calls).toEqual([["preview", "--json", "--show-sames", "--stack", "floci"]]);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
test("planned values: a preview with changes (a replaced VPC) leaves the outputs it moves unknown and keeps the rest, the secret neither known nor unknown", async () => {
|
|
135
|
-
const read = await previewPulumiMemberRead({ member: "aws", dir: AWS_DIR, run: awsCli({ preview: "preview-replaced.json" }).run });
|
|
136
|
-
const planned = pulumiMemberPlannedOutputs("aws", { ...read, exported: JSON.parse(text("pulumi-outputs", "stack-export.json")) });
|
|
137
|
-
expect(planned).toMatchObject({ known: KEPT, unknown: MOVED, changes: true, planDigest: read.part.member.planDigest });
|
|
138
|
-
expect(planned.unknown).not.toContain("dbPasswordValue");
|
|
139
|
-
expect(planned.known).not.toHaveProperty("dbPasswordValue");
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test("a member on plunge runs the same commands under plunge, never pulumi", async () => {
|
|
143
|
-
const pulumi = fake(() => {
|
|
144
|
-
throw new Error("pulumi must not run for a plunge member");
|
|
145
|
-
});
|
|
146
|
-
const plunge = awsCli({ preview: "preview-settled.json", outputs: "plunge-outputs" });
|
|
147
|
-
const source = pulumiOutputSource({ run: pulumi.run, plunge: plunge.run });
|
|
148
|
-
const plungeRef = { ...ref, dir: PLUNGE_DIR };
|
|
149
|
-
// plunge prints stack output exactly as pulumi does, the secret as "[secret]" (recorded).
|
|
150
|
-
expect(await source.applied(ctx, plungeRef)).toEqual(PLUNGE_APPLIED);
|
|
151
|
-
expect((await source.planned(ctx, plungeRef)).known).toEqual(PLUNGE_APPLIED);
|
|
152
|
-
expect(plunge.calls).toEqual([
|
|
153
|
-
["stack", "output", "--json", "--show-secrets=false", "--stack", "floci"],
|
|
154
|
-
["preview", "--json", "--show-sames", "--stack", "floci"],
|
|
155
|
-
]);
|
|
156
|
-
expect(pulumi.calls).toEqual([]);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test("both reads pass the declared stack over the export's (#4514)", async () => {
|
|
160
|
-
const cli = awsCli({ preview: "preview-settled.json" });
|
|
161
|
-
await pulumiMemberStackOutputs({ dir: AWS_DIR, stack: "prod", run: cli.run });
|
|
162
|
-
const read = await previewPulumiMemberRead({ member: "aws", dir: AWS_DIR, stack: "prod", run: cli.run });
|
|
163
|
-
expect(cli.calls).toEqual([
|
|
164
|
-
["stack", "output", "--json", "--show-secrets=false", "--stack", "prod"],
|
|
165
|
-
["preview", "--json", "--show-sames", "--stack", "prod"],
|
|
166
|
-
]);
|
|
167
|
-
expect(read.part.member.scope).toBe("prod");
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
test("a member with no export and no declared stack reads the selected stack, passing no --stack (#4514)", async () => {
|
|
171
|
-
const dir = join(testdata, "pulumi-unexported");
|
|
172
|
-
const cli = fake((args) => (args[0] === "stack" ? "{}" : text("pulumi-outputs", "preview-settled.json")));
|
|
173
|
-
const source = pulumiOutputSource({ run: cli.run });
|
|
174
|
-
const unexported = { ...ref, dir };
|
|
175
|
-
await source.applied(ctx, unexported);
|
|
176
|
-
await previewPulumiMemberRead({ member: "aws", dir, run: cli.run });
|
|
177
|
-
expect(cli.calls).toEqual([
|
|
178
|
-
["stack", "output", "--json", "--show-secrets=false"],
|
|
179
|
-
["preview", "--json", "--show-sames"],
|
|
180
|
-
]);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
test("a failed preview throws, naming the member", async () => {
|
|
184
|
-
const run: PulumiRunner = async () => {
|
|
185
|
-
throw Object.assign(new Error("exit 255"), { stderr: "error: no stack selected" });
|
|
186
|
-
};
|
|
187
|
-
await expect(pulumiOutputSource({ run }).planned(ctx, ref)).rejects.toThrow(/Pulumi member "aws" failed: error: no stack selected/);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test("the lexicon's capability plugin contributes the source and the pulumi-up verb (#4541)", () => {
|
|
191
|
-
expect(pulumiCapabilityPlugin.capabilities().map((c) => c.kind)).toEqual(["pulumi-up"]);
|
|
192
|
-
expect(pulumiCapabilityPlugin.engineOutputSources!().map((s) => s.kinds)).toEqual([["pulumi"]]);
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// ── dns planned against the aws member's output ────────────────────────────────
|
|
197
|
-
|
|
198
|
-
interface RecordsInput {
|
|
199
|
-
inputs: Record<string, unknown>;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const ESTATE: DriverComponent[] = [
|
|
203
|
-
memberOutputsComponent("aws") as unknown as DriverComponent,
|
|
204
|
-
{
|
|
205
|
-
name: "records",
|
|
206
|
-
dependsOn: ["aws"],
|
|
207
|
-
deploy: [{ phase: "Apply", steps: [{ kind: "fake-records", inputs: { vpcId: { stackOutput: { stack: "aws", name: "vpcId" } } } }] }],
|
|
208
|
-
},
|
|
209
|
-
];
|
|
210
|
-
|
|
211
|
-
function world(initial: { preview: string }) {
|
|
212
|
-
const state = {
|
|
213
|
-
preview: initial.preview,
|
|
214
|
-
stackOutput: text("pulumi-outputs", "stack-output.json"),
|
|
215
|
-
recordsPlanned: [] as Array<{ inputs: Record<string, unknown>; unresolved?: string[] }>,
|
|
216
|
-
recordsRan: [] as Array<Record<string, unknown>>,
|
|
217
|
-
};
|
|
218
|
-
const pulumi: PulumiRunner = async (args) => ({ stdout: args[0] === "stack" ? state.stackOutput : text("pulumi-outputs", state.preview) });
|
|
219
|
-
const lookup = async (_cwd: string, member: string): Promise<EngineMemberRef> => {
|
|
220
|
-
if (member !== "aws") throw new Error(`no member ${member}`);
|
|
221
|
-
return { member, kind: "pulumi", dir: AWS_DIR, workspaceRoot: testdata };
|
|
222
|
-
};
|
|
223
|
-
const dns: CapabilityPlugin = {
|
|
224
|
-
name: "fake-dns",
|
|
225
|
-
version: "0.0.0",
|
|
226
|
-
capabilities: () =>
|
|
227
|
-
[
|
|
228
|
-
{
|
|
229
|
-
kind: "fake-records",
|
|
230
|
-
async plan(ctx: DeployContext, input: RecordsInput) {
|
|
231
|
-
state.recordsPlanned.push({ inputs: { ...input.inputs }, ...(ctx.unresolvedInputs ? { unresolved: [...ctx.unresolvedInputs] } : {}) });
|
|
232
|
-
const planDigest = computePlanDigest("fake-records", { inputs: input.inputs, unresolved: ctx.unresolvedInputs ?? [] });
|
|
233
|
-
const holes = ctx.unresolvedInputs?.length ? [{ address: "records", reason: `inputs from ${ctx.unresolvedInputs.join(", ")}; re-checked on apply` }] : [];
|
|
234
|
-
return {
|
|
235
|
-
member: "records",
|
|
236
|
-
planDigest,
|
|
237
|
-
artifact: { planDigest },
|
|
238
|
-
changeSet: { member: { member: "records", lexicon: "aws", planner: "chant", status: "planned", planDigest, holes }, entries: [] },
|
|
239
|
-
};
|
|
240
|
-
},
|
|
241
|
-
async run(_ctx: DeployContext, input: RecordsInput) {
|
|
242
|
-
state.recordsRan.push({ ...input.inputs });
|
|
243
|
-
return {};
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
] as never,
|
|
247
|
-
};
|
|
248
|
-
// The lexicon's plugin, its source on the fake runner; the starter set's member-outputs with the test's lookup.
|
|
249
|
-
const pulumiPlugin: CapabilityPlugin = { ...pulumiCapabilityPlugin, engineOutputSources: () => [pulumiOutputSource({ run: pulumi })] };
|
|
250
|
-
const starter = { ...starterCapabilityPlugin, capabilities: () => starterCapabilityPlugin.capabilities().filter((c) => c.kind !== MEMBER_OUTPUTS_KIND).concat([memberOutputsCapability({ lookup }) as never]) };
|
|
251
|
-
const registry = registerCapabilityPlugins(new CapabilityRegistry(), [starter as CapabilityPlugin, pulumiPlugin, dns]);
|
|
252
|
-
return { registry, state };
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const NOW = "2026-10-25T00:00:00Z";
|
|
256
|
-
|
|
257
|
-
describe("dns against a Pulumi output (#4455)", () => {
|
|
258
|
-
test("an applied Pulumi output feeds dns's parameter when the change does not touch the member", async () => {
|
|
259
|
-
const w = world({ preview: "preview-settled.json" });
|
|
260
|
-
const plan = planFanOut({ components: ESTATE, changed: ["records"] });
|
|
261
|
-
const set = await planPrSet({ components: ESTATE, plan, registry: w.registry, env: "local" });
|
|
262
|
-
expect(set.failed).toBe(false);
|
|
263
|
-
expect(w.state.recordsPlanned).toEqual([{ inputs: { vpcId: OLD } }]);
|
|
264
|
-
expect(set.deployedOutputs).toEqual({ aws: Object.keys(APPLIED).sort() });
|
|
265
|
-
const records = set.members.find((m) => m.member === "records")!;
|
|
266
|
-
expect(records.unknownInputs).toBeUndefined();
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
test("a known planned Pulumi output feeds dns's parameter when the change touches the member", async () => {
|
|
270
|
-
const w = world({ preview: "preview-settled.json" });
|
|
271
|
-
const plan = planFanOut({ components: ESTATE, changed: ["aws"] });
|
|
272
|
-
const set = await planPrSet({ components: ESTATE, plan, registry: w.registry, env: "local" });
|
|
273
|
-
expect(w.state.recordsPlanned).toEqual([{ inputs: { vpcId: OLD } }]);
|
|
274
|
-
expect(set.plannedOutputs).toEqual({ aws: Object.keys(APPLIED).sort() });
|
|
275
|
-
expect(set.doc.members.find((m) => m.member === memberOutputsMemberName("aws"))!.holes).toEqual([]);
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
test("an unknown Pulumi output holds dns back, naming the member and the output", async () => {
|
|
279
|
-
const w = world({ preview: "preview-replaced.json" });
|
|
280
|
-
const plan = planFanOut({ components: ESTATE, changed: ["aws"] });
|
|
281
|
-
const set = await planPrSet({ components: ESTATE, plan, registry: w.registry, env: "local" });
|
|
282
|
-
expect(set.failed).toBe(false);
|
|
283
|
-
|
|
284
|
-
expect(w.state.recordsPlanned).toEqual([{ inputs: {}, unresolved: ["aws"] }]);
|
|
285
|
-
const records = set.members.find((m) => m.member === "records")!;
|
|
286
|
-
expect(records.unknownInputs).toEqual(["aws.vpcId"]);
|
|
287
|
-
expect(records.reads).toEqual([{ upstream: "aws", outputs: ["vpcId"], unknown: ["vpcId"] }]);
|
|
288
|
-
// Each output the preview moves is unknown while it has changes: one hole each (#4635).
|
|
289
|
-
const holes = set.doc.members.find((m) => m.member === memberOutputsMemberName("aws"))!.holes;
|
|
290
|
-
expect(holes.map((h) => h.address)).toEqual(MOVED.map((o) => `aws.${o}`));
|
|
291
|
-
expect(holes).toContainEqual({ address: "aws.vpcId", type: "output", reason: "aws.vpcId is known only after aws applies; what reads it is planned again then" });
|
|
292
|
-
|
|
293
|
-
// Merged before aws's own pipeline applied: the read refuses, so records is blocked behind it.
|
|
294
|
-
const early = await applyPrSet({ components: ESTATE, plan, registry: w.registry, env: "local", set });
|
|
295
|
-
expect(early.members.find((m) => m.member === "records")).toMatchObject({ status: "blocked", blockedBy: "aws" });
|
|
296
|
-
expect(w.state.recordsRan).toEqual([]);
|
|
297
|
-
|
|
298
|
-
// Once aws applied: records is held back with the reason, and planned again against the applied value.
|
|
299
|
-
const NEW = "vpc-0new";
|
|
300
|
-
w.state.stackOutput = JSON.stringify({ ...APPLIED, vpcId: NEW, dbPasswordValue: "[secret]" });
|
|
301
|
-
w.state.preview = "preview-settled.json";
|
|
302
|
-
const decideNothing = async ({ gate, set: round }: { gate: string; set: PrPlanSet }) => {
|
|
303
|
-
const check = await decidePrGate(readOnlyLedger(memoryGateLedgerPort()), { op: "pr-12", gate, digest: round.doc.digest, now: NOW });
|
|
304
|
-
return { satisfied: check.satisfied, approval: approvalOf(check) };
|
|
305
|
-
};
|
|
306
|
-
const held = await applyPrSet({ components: ESTATE, plan, registry: w.registry, env: "local", set, decideRound: decideNothing });
|
|
307
|
-
expect(held.status).toBe("waiting");
|
|
308
|
-
expect(held.members.find((m) => m.member === "records")).toMatchObject({
|
|
309
|
-
status: "waiting",
|
|
310
|
-
round: 2,
|
|
311
|
-
held: "its plan read aws.vpcId before that output applied as another value",
|
|
312
|
-
});
|
|
313
|
-
expect(w.state.recordsRan).toEqual([]);
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
test("a reader of an output the preview leaves alone plans now with the export's value (#4635)", async () => {
|
|
317
|
-
const w = world({ preview: "preview-replaced.json" });
|
|
318
|
-
const estate: DriverComponent[] = [
|
|
319
|
-
ESTATE[0]!,
|
|
320
|
-
{ ...ESTATE[1]!, deploy: [{ phase: "Apply", steps: [{ kind: "fake-records", inputs: { bucket: { stackOutput: { stack: "aws", name: "siteBucketName" } } } }] }] } as DriverComponent,
|
|
321
|
-
];
|
|
322
|
-
const plan = planFanOut({ components: estate, changed: ["aws"] });
|
|
323
|
-
const set = await planPrSet({ components: estate, plan, registry: w.registry, env: "local" });
|
|
324
|
-
expect(set.failed).toBe(false);
|
|
325
|
-
expect(w.state.recordsPlanned).toEqual([{ inputs: { bucket: "rec-ts-site" } }]);
|
|
326
|
-
const records = set.members.find((m) => m.member === "records")!;
|
|
327
|
-
expect(records.unknownInputs).toBeUndefined();
|
|
328
|
-
expect(records.reads).toEqual([{ upstream: "aws", outputs: ["siteBucketName"] }]);
|
|
329
|
-
expect(set.plannedOutputs).toEqual({ aws: Object.keys(KEPT).sort() });
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
test("run refuses while the stack's preview has changes left", async () => {
|
|
333
|
-
const w = world({ preview: "preview-replaced.json" });
|
|
334
|
-
const capability = w.registry.resolve(MEMBER_OUTPUTS_KIND);
|
|
335
|
-
await expect(capability.run({ env: "local", component: "aws" }, { member: "aws" } as never)).rejects.toBeInstanceOf(MemberOutputsPendingError);
|
|
336
|
-
w.state.preview = "preview-settled.json";
|
|
337
|
-
await expect(capability.run({ env: "local", component: "aws" }, { member: "aws" } as never)).resolves.toEqual({ member: "aws", outputs: APPLIED });
|
|
338
|
-
});
|
|
339
|
-
});
|
package/src/member-outputs.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Pulumi engine's member outputs (#4455): what core's `member-outputs`
|
|
3
|
-
* verb reads a workspace member of kind `pulumi` through, the Pulumi half
|
|
4
|
-
* beside the terraform lexicon's `choudoufuOutputSource`.
|
|
5
|
-
*
|
|
6
|
-
* - Applied values: `pulumi stack output --json --show-secrets=false` in the
|
|
7
|
-
* member's directory ({@link pulumiMemberStackOutputs}). With
|
|
8
|
-
* `applied: "export"` (or `CHANT_PULUMI_APPLIED_OUTPUTS=export` in the
|
|
9
|
-
* environment), chant runs no engine and reads the stack's outputs from
|
|
10
|
-
* the export instead (`pulumiExportedStackOutputs`): the one the last
|
|
11
|
-
* apply through chant wrote to the index store (#4546), else the
|
|
12
|
-
* checked-in `stack-export.json`. That is for a machine with no pulumi
|
|
13
|
-
* login.
|
|
14
|
-
* - Planned values: `pulumi preview --json` through `previewPulumiMemberRead`,
|
|
15
|
-
* the stack step's outputs read by `pulumiPlannedStackOutputs`. An output
|
|
16
|
-
* holding Pulumi's unknown sentinel is unknown, which core turns into a
|
|
17
|
-
* hole on `<member>#outputs` naming the output and holds whatever reads it
|
|
18
|
-
* back until the member applied, the same path a choudoufu output takes.
|
|
19
|
-
* The plan digest is the member part's (`computePlanDigest("pulumi-preview",
|
|
20
|
-
* ...)`), so a preview that moves after review moves the consumer's digest.
|
|
21
|
-
*
|
|
22
|
-
* A preview with changes that plans no stack outputs (every real one,
|
|
23
|
-
* #4475) traces each output to the export's resources
|
|
24
|
-
* (`./planned-output-changes.ts`, #4635): an output whose resources the
|
|
25
|
-
* preview leaves alone keeps the export's value, and the others are
|
|
26
|
-
* unknown. A stack that reads only unchanged outputs plans now; one that
|
|
27
|
-
* reads a changing one waits for the producer's `up`.
|
|
28
|
-
*
|
|
29
|
-
* A member on plunge (`pulumiMemberEngine`: the member config, then a
|
|
30
|
-
* `plunge` backend URL in `Pulumi.yaml`) runs the same two commands under
|
|
31
|
-
* `plunge`.
|
|
32
|
-
*
|
|
33
|
-
* Secrets stay secret. `--show-secrets=false` prints a secret as
|
|
34
|
-
* `[secret]`, an export holds it as ciphertext, and a preview as a secret
|
|
35
|
-
* envelope; in every case the output is left out of what the source
|
|
36
|
-
* returns, so chant never carries the value and never prints it. A
|
|
37
|
-
* parameter that reads a secret output reads nothing: pass secrets through
|
|
38
|
-
* the engine's own secret store, not chant parameters.
|
|
39
|
-
*
|
|
40
|
-
* Both commands pass `--stack` (#4514), by #4496's rule (`./run.ts`'s
|
|
41
|
-
* `memberStack`): the member's declared stack, else the stack the checked-in
|
|
42
|
-
* `stack-export.json` names in its URNs. The workspace declaration names no
|
|
43
|
-
* stack for a member, so here it is the export's. A member with no export,
|
|
44
|
-
* or one whose URNs name more than one stack, reads the selected stack.
|
|
45
|
-
*/
|
|
46
|
-
import type { DeployContext } from "@intentius/chant/components/capability";
|
|
47
|
-
import type { EngineMemberRef, EngineOutputSource, EnginePlannedOutputs } from "@intentius/chant/components/verbs/member-outputs";
|
|
48
|
-
import type { ChangeSetPart } from "@intentius/chant/change-set";
|
|
49
|
-
import { pulumiPlannedOutputChanges, type PulumiOutputChange } from "./planned-output-changes";
|
|
50
|
-
import { pulumiPlannedStackOutputs, pulumiExportedStackOutputs, type PulumiStackOutput } from "./stack-outputs";
|
|
51
|
-
import { memberExportOf, previewPulumiMemberRead, pulumiMemberStackOutputs, type PulumiMemberEngine, type PulumiRunner } from "./run";
|
|
52
|
-
import { isSecret } from "./values";
|
|
53
|
-
import { PULUMI_EXPORT_FILE } from "./workspace-member";
|
|
54
|
-
|
|
55
|
-
/** Where a member's applied outputs are read from. */
|
|
56
|
-
export type PulumiAppliedFrom = "cli" | "export";
|
|
57
|
-
|
|
58
|
-
/** The environment variable that makes the source read applied outputs from the checked-in export. */
|
|
59
|
-
export const PULUMI_APPLIED_OUTPUTS_ENV = "CHANT_PULUMI_APPLIED_OUTPUTS";
|
|
60
|
-
|
|
61
|
-
export interface PulumiOutputSourceOptions {
|
|
62
|
-
/** Where applied values come from. Default: `export` when {@link PULUMI_APPLIED_OUTPUTS_ENV} says so, else `cli`. */
|
|
63
|
-
applied?: PulumiAppliedFrom;
|
|
64
|
-
/** The member's engine, when it is not taken from `Pulumi.yaml`. */
|
|
65
|
-
engine?: PulumiMemberEngine;
|
|
66
|
-
run?: PulumiRunner;
|
|
67
|
-
plunge?: PulumiRunner;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** The known values of a stack's outputs: unknown and secret ones left out. */
|
|
71
|
-
function knownValues(outputs: readonly PulumiStackOutput[]): Record<string, unknown> {
|
|
72
|
-
const out: Record<string, unknown> = {};
|
|
73
|
-
for (const o of outputs) if (!o.unknown && !o.secret) out[o.name] = o.value;
|
|
74
|
-
return out;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** `stack output --json` with the blinded secrets left out. */
|
|
78
|
-
function withoutSecrets(printed: Record<string, unknown>): Record<string, unknown> {
|
|
79
|
-
return Object.fromEntries(Object.entries(printed).filter(([, v]) => !isSecret(v)));
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Whether the member's part has anything to apply: an entry that is not a
|
|
84
|
-
* no-op or a read, or a hole. An export-only `mayAppear` update is left out:
|
|
85
|
-
* it marks what the preview could not list, not a change it planned.
|
|
86
|
-
*/
|
|
87
|
-
export function pulumiPartHasChanges(part: ChangeSetPart): boolean {
|
|
88
|
-
if (part.member.holes.length > 0) return true;
|
|
89
|
-
return part.entries.some((e) => e.action !== "no-op" && e.action !== "read" && !(e.mayAppear === true && e.action === "update"));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* What a member's preview says about its stack outputs (#4455): the stack
|
|
94
|
-
* step's outputs, unknowns named, secrets left out; the part's digest; and
|
|
95
|
-
* whether it has changes. A failed preview throws, naming the member and
|
|
96
|
-
* the preview's error. A preview that plans no stack outputs (no stack step,
|
|
97
|
-
* or one without outputs, which is what a real `pulumi preview --json`
|
|
98
|
-
* prints, #4475) gives the export's outputs when it plans nothing to apply,
|
|
99
|
-
* since no apply will move them. With changes, each output is traced to the
|
|
100
|
-
* export's resources (#4635, {@link pulumiPlannedOutputChanges}): the ones
|
|
101
|
-
* the preview leaves alone keep their value, and the rest are unknown, so
|
|
102
|
-
* nothing reads a value the preview may move. `outputChanges` lists each
|
|
103
|
-
* output's verdict and why.
|
|
104
|
-
*/
|
|
105
|
-
export function pulumiMemberPlannedOutputs(
|
|
106
|
-
member: string,
|
|
107
|
-
read: { part: ChangeSetPart; preview: unknown; exported?: unknown; targeted?: boolean },
|
|
108
|
-
): EnginePlannedOutputs & { outputChanges?: PulumiOutputChange[] } {
|
|
109
|
-
const { part } = read;
|
|
110
|
-
if (part.member.status === "failed" || part.member.planDigest === null) {
|
|
111
|
-
throw new Error(`member-outputs: the preview of Pulumi member "${member}" failed: ${part.member.error ?? "no plan"}`);
|
|
112
|
-
}
|
|
113
|
-
const planned = pulumiPlannedStackOutputs(read.preview);
|
|
114
|
-
const changes = pulumiPartHasChanges(part);
|
|
115
|
-
if (planned === undefined) {
|
|
116
|
-
const exported = read.exported === undefined ? [] : pulumiExportedStackOutputs(read.exported);
|
|
117
|
-
if (!changes) return { known: knownValues(exported), unknown: [], planDigest: part.member.planDigest, changes };
|
|
118
|
-
if (part.member.holes.length > 0 || read.exported === undefined) {
|
|
119
|
-
return { known: {}, unknown: exported.filter((o) => !o.secret).map((o) => o.name), planDigest: part.member.planDigest, changes };
|
|
120
|
-
}
|
|
121
|
-
const traced = pulumiPlannedOutputChanges({ part, exported: read.exported, ...(read.targeted ? { targeted: true } : {}) });
|
|
122
|
-
return { known: traced.known, unknown: traced.unknown, planDigest: part.member.planDigest, changes, outputChanges: traced.outputs };
|
|
123
|
-
}
|
|
124
|
-
const unknown = planned.filter((o) => o.unknown).map((o) => o.name);
|
|
125
|
-
return { known: knownValues(planned), unknown, planDigest: part.member.planDigest, changes: changes || unknown.length > 0 };
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/** The applied outputs a `pulumi stack export` records, secrets left out. */
|
|
129
|
-
export function pulumiExportedOutputValues(exported: unknown): Record<string, unknown> {
|
|
130
|
-
return knownValues(pulumiExportedStackOutputs(exported));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/** A Pulumi member's outputs for `member-outputs`, `kinds: ["pulumi"]`. */
|
|
134
|
-
export function pulumiOutputSource(options: PulumiOutputSourceOptions = {}): EngineOutputSource {
|
|
135
|
-
const appliedFrom = (): PulumiAppliedFrom => options.applied ?? (process.env[PULUMI_APPLIED_OUTPUTS_ENV] === "export" ? "export" : "cli");
|
|
136
|
-
const runners = { ...(options.run ? { run: options.run } : {}), ...(options.plunge ? { plunge: options.plunge } : {}), ...(options.engine ? { engine: options.engine } : {}) };
|
|
137
|
-
return {
|
|
138
|
-
kinds: ["pulumi"],
|
|
139
|
-
async applied(_ctx: DeployContext, ref: EngineMemberRef) {
|
|
140
|
-
if (appliedFrom() === "export") {
|
|
141
|
-
const exported = await memberExportOf(ref.dir);
|
|
142
|
-
if (exported === undefined) {
|
|
143
|
-
throw new Error(`member-outputs: Pulumi member "${ref.member}" has no export in the index store and no readable ${PULUMI_EXPORT_FILE} in ${ref.dir}, and its outputs are read from the export (${PULUMI_APPLIED_OUTPUTS_ENV}=export)`);
|
|
144
|
-
}
|
|
145
|
-
return pulumiExportedOutputValues(exported);
|
|
146
|
-
}
|
|
147
|
-
return withoutSecrets(await pulumiMemberStackOutputs({ dir: ref.dir, ...runners }));
|
|
148
|
-
},
|
|
149
|
-
async planned(_ctx: DeployContext, ref: EngineMemberRef) {
|
|
150
|
-
const read = await previewPulumiMemberRead({ member: ref.member, dir: ref.dir, ...runners });
|
|
151
|
-
return pulumiMemberPlannedOutputs(ref.member, { ...read, exported: await memberExportOf(ref.dir) });
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** The source the lexicon's capability plugin contributes. */
|
|
157
|
-
export const pulumiStackOutputSource: EngineOutputSource = pulumiOutputSource();
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pulumi Op activities (#4494), resolved by the core activity registry when a
|
|
3
|
-
* project's `chant.config.ts` lists the `pulumi` lexicon. `loadActivities`
|
|
4
|
-
* (`packages/core/src/op/activity-registry.ts`) imports
|
|
5
|
-
* `@intentius/chant-lexicon-pulumi/op/activities` and keys every exported
|
|
6
|
-
* function by its name, so this module exports activities and nothing else
|
|
7
|
-
* callable:
|
|
8
|
-
*
|
|
9
|
-
* - pulumiPreview: `pulumi preview --json` in the member's directory, as
|
|
10
|
-
* change counts and the plan digest.
|
|
11
|
-
* - pulumiDrift: one `pulumi refresh --preview-only --json --target <urn>`
|
|
12
|
-
* per resource (`plunge drift --resource <urn> --stream` on plunge), as
|
|
13
|
-
* drift counts.
|
|
14
|
-
*
|
|
15
|
-
* - pulumiAdoptCheck, pulumiAdoptExport, pulumiAdoptPreview, pulumiAdopt:
|
|
16
|
-
* `PulumiAdoptOp`'s steps (#4562), the shared bucket check, the stock
|
|
17
|
-
* checkpoint's export, `plunge stack adopt --json` and, after the gate,
|
|
18
|
-
* `plunge stack adopt --json --yes`. See `./pulumi-adopt.ts`.
|
|
19
|
-
*
|
|
20
|
-
* Only `pulumiAdopt` changes anything: it writes plunge's records. See
|
|
21
|
-
* `./pulumi.ts`.
|
|
22
|
-
*/
|
|
23
|
-
export { pulumiPreview, pulumiDrift } from "./pulumi";
|
|
24
|
-
export { pulumiAdoptCheck, pulumiAdoptExport, pulumiAdoptPreview, pulumiAdopt } from "./pulumi-adopt";
|
|
25
|
-
export type {
|
|
26
|
-
PulumiAdoptStackArgs,
|
|
27
|
-
PulumiAdoptCheckArgs,
|
|
28
|
-
PulumiAdoptCheckResult,
|
|
29
|
-
PulumiAdoptExportArgs,
|
|
30
|
-
PulumiAdoptExportResult,
|
|
31
|
-
PulumiAdoptPreviewArgs,
|
|
32
|
-
PulumiAdoptPreviewResult,
|
|
33
|
-
PulumiAdoptArgs,
|
|
34
|
-
PulumiAdoptResult,
|
|
35
|
-
} from "./pulumi-adopt";
|
|
36
|
-
export type { PulumiMemberArgs, PulumiPreviewArgs, PulumiPreviewResult, PulumiDriftArgs, PulumiDriftResult } from "./pulumi";
|