@alienplatform/core 3.3.42 → 3.3.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,3 +58,53 @@ CloudFormation exposes declared choices as parameters such as `ContainerApiCpu`
58
58
  and `ContainerApiMemory`. Terraform and API deployments carry selections in
59
59
  deployment settings. The deployment portal exposes the declared ranges and
60
60
  replans machine choices when allocations change.
61
+
62
+ ### Conditional inputs
63
+
64
+ Use `when` for inputs that only apply while another boolean input has a given value:
65
+
66
+ ```ts
67
+ const io = alien.inputs({
68
+ snapshotsEnabled: alien.boolean({
69
+ providedBy: "deployer", required: true, default: true,
70
+ label: "Snapshots enabled", description: "Keep periodic snapshots.",
71
+ }),
72
+ snapshotBucket: alien.string({
73
+ providedBy: "deployer", required: true,
74
+ label: "Snapshot bucket", description: "Bucket for snapshots.",
75
+ when: { input: "snapshotsEnabled", equals: true },
76
+ env: "SNAPSHOT_BUCKET",
77
+ }),
78
+ })
79
+ ```
80
+
81
+ The condition reads the provided boolean, otherwise its default. Inactive inputs
82
+ are not asked for, required, validated or mapped into environment variables.
83
+ Provided values for inactive inputs are ignored, so callers can submit full forms.
84
+ When active, the input's normal requiredness and validation apply.
85
+
86
+ The referenced input must be a boolean in the same stack and must not have its own
87
+ `when`. Self-references, chains and cycles are rejected. A conditional boolean
88
+ cannot gate a resource with `.enabled()`. A deployer-provided input requires a
89
+ controller that can also be provided by the deployer; developer-only controllers
90
+ may control developer-only inputs. `when` cannot be combined with `generate`.
91
+ An input excluded from the deployment platform does not apply. An off-platform
92
+ controller resolves to false, so `equals: false` matches and `equals: true` does
93
+ not. An unanswered on-platform reference matches neither value.
94
+
95
+ Both the CLI and manager must include conditional-input support before releasing
96
+ or installing a stack that uses `when`. Version 3.3.43 predates that support;
97
+ until a supporting release is tagged, build both from the revision introducing
98
+ this feature or newer. Older CLIs and managers can require inactive inputs.
99
+ Hosted management must also have conditional-input support deployed before any
100
+ stack using `when` is released.
101
+
102
+ Terraform modules using conditional inputs require Terraform 1.9 or newer.
103
+ CloudFormation uses Rules for conditional requiredness; other constraints are
104
+ validated during registration because CloudFormation parameter constraints apply
105
+ even when an input is inactive.
106
+
107
+ CloudFormation does not evaluate Rules when creating a CREATE change set. It
108
+ checks them during stack creation: a failed assertion rolls the stack back before
109
+ creating resources. Validate both condition states with CreateStack, not only
110
+ CreateChangeSet.