# InsightVariable

> Resource InsightVariable in pulumi-posthog.

<!-- Generated from the pulumi-posthog SDK. -->

Resource InsightVariable in pulumi-posthog.

Pulumi type: `posthog:index/insightVariable:InsightVariable`.

`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.

```ts
import * as posthog from "pulumi-posthog"

const resource = new posthog.InsightVariable("insightVariable", {
  type: "<type>",
})
```

## Arguments

| Property           | Type     | Required | Description                                                                                                                                                                                                                                                                                                 |
| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defaultValueJson` | `string` | no       | JSON-encoded default value used when a query references the variable and no value is supplied. The value is a bare JSON scalar for most types, so wrap it: `jsonencode("prod")`, `jsonencode(30)`, `jsonencode(true)`. For `List` variables PostHog stores the default as a string, so encode it as one.    |
| `name`             | `string` | no       | Human-readable name for the SQL variable, shown above the input.                                                                                                                                                                                                                                            |
| `projectId`        | `string` | no       | Project ID (environment) for this resource. Overrides the provider-level project_id.                                                                                                                                                                                                                        |
| `type`             | `string` | yes      | Variable type, which controls how the value is rendered and substituted into HogQL: `String`, `Number`, `Boolean`, `List`, or `Date`.                                                                                                                                                                       |
| `valuesJson`       | `string` | no       | JSON-encoded array of allowed values, for `List` variables only. PostHog stores every entry as a string, so encode them as strings: `jsonencode(["1", "2"])` rather than `jsonencode([1, 2])`. Otherwise the value PostHog returns will not match your configuration. Leave unset for other variable types. |

## Outputs

Computed outputs are produced by the provider. They are not constructor arguments.

| Property           | Type     | Computed | Description                                                                                                                                                                                                                                                                                                 |
| ------------------ | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `codeName`         | `string` | yes      | Code-safe name generated from `name`, referenced in HogQL as `{variables.code_name}`. PostHog derives it once at creation and keeps it if you later rename the variable, so queries do not break on a rename. It must be unique within the project.                                                         |
| `createdAt`        | `string` | yes      | Timestamp when the SQL variable was created.                                                                                                                                                                                                                                                                |
| `defaultValueJson` | `string` | no       | JSON-encoded default value used when a query references the variable and no value is supplied. The value is a bare JSON scalar for most types, so wrap it: `jsonencode("prod")`, `jsonencode(30)`, `jsonencode(true)`. For `List` variables PostHog stores the default as a string, so encode it as one.    |
| `name`             | `string` | no       | Human-readable name for the SQL variable, shown above the input.                                                                                                                                                                                                                                            |
| `projectId`        | `string` | no       | Project ID (environment) for this resource. Overrides the provider-level project_id.                                                                                                                                                                                                                        |
| `type`             | `string` | no       | Variable type, which controls how the value is rendered and substituted into HogQL: `String`, `Number`, `Boolean`, `List`, or `Date`.                                                                                                                                                                       |
| `valuesJson`       | `string` | no       | JSON-encoded array of allowed values, for `List` variables only. PostHog stores every entry as a string, so encode them as strings: `jsonencode(["1", "2"])` rather than `jsonencode([1, 2])`. Otherwise the value PostHog returns will not match your configuration. Leave unset for other variable types. |
