Resource Experiment in pulumi-posthog.
Pulumi type: posthog:index/experiment:Experiment.
name is the Pulumi resource name. Nested object fields are documented under that object. They are not arguments of this resource.
Example#
Only required arguments are set. A string in angle brackets stands in for that argument. Any other value is an option or example written in the SDK description.
Arguments#
| Property | Type | Required | Description |
|---|---|---|---|
allowUnknownEvents | boolean | no | Opt-in bypass of the API validation that rejects metrics referencing not-yet-ingested events. Sent on every write (so a draft with such a metric can still be launched/edited); config-only, not read back from the API. |
description | string | no | Experiment description. |
exposureCriteria | string | no | Exposure criteria as a JSON object (this is where filterTestAccounts lives). Same semantic-compare handling as metrics. |
featureFlagKey | string | yes | Key of the multivariate feature flag this experiment runs on. Reference a 'posthog.FeatureFlag' resource — e.g. 'featureFlagKey'= posthog_feature_flag.<name>.key'. The flag must already exist and be multivariate (2–20 variants, one keyed 'control'). Changing this forces a new experiment (a linked flag cannot be re-keyed in place). |
holdoutId | number | no | ID of an existing holdout group to reference. Holdout management itself is out of scope. |
metrics | string | no | Primary metrics as a JSON array. Compared semantically, so key ordering and whitespace differences from the PostHog API do not produce a diff. Only fields you declare are tracked; server-computed fields (e.g. metric fingerprints) are ignored. |
metricsSecondary | string | no | Secondary metrics as a JSON array. Same semantic-compare handling as metrics. |
name | string | no | Experiment name. |
projectId | string | no | Project ID (environment) for this resource. Overrides the provider-level project_id. |
status | ExperimentStatus (input) | no | Desired lifecycle state. The status block and its state are required (the block is schema-optional only because Terraform has no required-block modifier; a plan without it errors). Declare it to drive the experiment through draft → running → paused → stopped; the provider maps the desired state (vs. the current state) to the matching launch/pause/resume/end/ship sub-action. The lifecycle is forward-only — backward transitions error. Note: a transition spanning two sub-actions in one apply (e.g. creating directly as paused = launch+pause, or stopped = launch+end) is not atomic — if the second action fails the experiment is left mid-transition; the error names its live state so you can reconcile. The server-only exposureFrozen state cannot be managed here; resume or end such an experiment in the PostHog UI first. |
Outputs#
Computed outputs are produced by the provider. They are not constructor arguments.
| Property | Type | Computed | Description |
|---|---|---|---|
allowUnknownEvents | boolean | no | Opt-in bypass of the API validation that rejects metrics referencing not-yet-ingested events. Sent on every write (so a draft with such a metric can still be launched/edited); config-only, not read back from the API. |
description | string | no | Experiment description. |
experimentId | number | yes | Experiment ID. |
exposureCriteria | string | no | Exposure criteria as a JSON object (this is where filterTestAccounts lives). Same semantic-compare handling as metrics. |
featureFlagKey | string | no | Key of the multivariate feature flag this experiment runs on. Reference a 'posthog.FeatureFlag' resource — e.g. 'featureFlagKey'= posthog_feature_flag.<name>.key'. The flag must already exist and be multivariate (2–20 variants, one keyed 'control'). Changing this forces a new experiment (a linked flag cannot be re-keyed in place). |
holdoutId | number | no | ID of an existing holdout group to reference. Holdout management itself is out of scope. |
metrics | string | no | Primary metrics as a JSON array. Compared semantically, so key ordering and whitespace differences from the PostHog API do not produce a diff. Only fields you declare are tracked; server-computed fields (e.g. metric fingerprints) are ignored. |
metricsSecondary | string | no | Secondary metrics as a JSON array. Same semantic-compare handling as metrics. |
name | string | no | Experiment name. |
projectId | string | no | Project ID (environment) for this resource. Overrides the provider-level project_id. |
status | ExperimentStatus (output) | no | Desired lifecycle state. The status block and its state are required (the block is schema-optional only because Terraform has no required-block modifier; a plan without it errors). Declare it to drive the experiment through draft → running → paused → stopped; the provider maps the desired state (vs. the current state) to the matching launch/pause/resume/end/ship sub-action. The lifecycle is forward-only — backward transitions error. Note: a transition spanning two sub-actions in one apply (e.g. creating directly as paused = launch+pause, or stopped = launch+end) is not atomic — if the second action fails the experiment is left mid-transition; the error names its live state so you can reconcile. The server-only exposureFrozen state cannot be managed here; resume or end such an experiment in the PostHog UI first. |
ExperimentStatus (input)#
Input object ExperimentStatus. Fields below belong to this object, not to the parent.
| Property | Type | Required | Description |
|---|---|---|---|
state | string | no | Desired lifecycle state — one of draft, running, paused, or stopped (required; use draft for a not-yet-launched experiment). The lifecycle is forward-only. |
stopped | ExperimentStatusStopped (input) | no | Metadata applied when stopping the experiment (read only when state = "stopped", ignored otherwise). |
ExperimentStatusStopped (input)#
Input object ExperimentStatusStopped. Fields below belong to this object, not to the parent.
| Property | Type | Required | Description |
|---|---|---|---|
conclusion | string | no | Conclusion recorded when the experiment is stopped — one of won, lost, inconclusive, stoppedEarly, invalid. Fully managed: applied at stop time and editable afterwards (an edit on an already-stopped experiment is PATCHed and read back). |
conclusionComment | string | no | Free-text note recorded alongside the conclusion. Fully managed (sent on stop/update and read back). |
releaseToEveryone | boolean | no | When shipping, prepend a catch-all release condition (roll out to everyone) instead of only flipping the variant distribution. Defaults to false. Config-only. |
shipVariant | string | no | Key of the winning variant to ship. Rewrites the linked flag's distribution so this variant gets 100% and ends the experiment. If the flag is managed by a posthog.FeatureFlag resource, set lifecycle {ignoreChanges= [filters] } on it so it does not revert the shipped distribution. Config-only; re-ships only when this value changes; clearing it does not un-ship. |
ExperimentStatus (output)#
Output object ExperimentStatus. Fields below belong to this object.
| Property | Type | Always present | Description |
|---|---|---|---|
state | string | no | Desired lifecycle state — one of draft, running, paused, or stopped (required; use draft for a not-yet-launched experiment). The lifecycle is forward-only. |
stopped | ExperimentStatusStopped (output) | no | Metadata applied when stopping the experiment (read only when state = "stopped", ignored otherwise). |
ExperimentStatusStopped (output)#
Output object ExperimentStatusStopped. Fields below belong to this object.
| Property | Type | Always present | Description |
|---|---|---|---|
conclusion | string | no | Conclusion recorded when the experiment is stopped — one of won, lost, inconclusive, stoppedEarly, invalid. Fully managed: applied at stop time and editable afterwards (an edit on an already-stopped experiment is PATCHed and read back). |
conclusionComment | string | no | Free-text note recorded alongside the conclusion. Fully managed (sent on stop/update and read back). |
releaseToEveryone | boolean | no | When shipping, prepend a catch-all release condition (roll out to everyone) instead of only flipping the variant distribution. Defaults to false. Config-only. |
shipVariant | string | no | Key of the winning variant to ship. Rewrites the linked flag's distribution so this variant gets 100% and ends the experiment. If the flag is managed by a posthog.FeatureFlag resource, set lifecycle {ignoreChanges= [filters] } on it so it does not revert the shipped distribution. Config-only; re-ships only when this value changes; clearing it does not un-ship. |