You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: Wire up text related to the Terraform provider on the main website (#14185)
* chore: Wire up text related to the Terraform provider on the main website
* chore: Little bit of copy update
* chore: Little bit of copy update
* chore: Statis has a TF provider
* chore: Terraform is out of beta, our addons are not
* chore: The provider is not in beta, only the in-app exporer
* chore: Some more small improvements
Copy file name to clipboardExpand all lines: contents/docs/libraries.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,3 +14,9 @@ This document outlines all of our current client-side and server-side libraries,
14
14
>**Note:** Session recording and autocapture are not possible in server libraries.
15
15
16
16
<LibraryComparison />
17
+
18
+
## Developer tools
19
+
20
+
In addition to SDKs, PostHog offers tools for managing your analytics infrastructure programmatically:
21
+
22
+
-**[Terraform provider](https://registry.terraform.io/providers/PostHog/posthog/latest)** - Manage dashboards, insights, and other PostHog resources as infrastructure-as-code.
<CalloutBoxicon="IconInfo"title="Terraform integration is in beta"type="fyi">
4
+
5
+
The in-app export features are currently in beta. To enable the "Manage with Terraform" button, opt in for `Infrastructure as Code for Analytics` via [Feature Previews](https://app.posthog.com/settings/user-feature-previews) in your settings.
6
+
7
+
If you have questions or suggestions, please [open an issue on GitHub](https://github.com/PostHog/terraform-provider-posthog/issues) or [reach out to us directly](https://app.posthog.com#panel=support%3Afeedback%3A%3Alow%3Atrue) in app.
Dashboards are the easiest way to track all your most important product and performance metrics.
29
29
30
-
Unlike [notebooks](/docs/notebooks), which are ideal of adhoc analysis of specific issues, dashboards are designed for tracking common metrics over time.
30
+
Unlike [notebooks](/docs/notebooks), which are ideal for adhoc analysis of specific issues, dashboards are designed for tracking common metrics over time.
31
31
32
32
You can create a new dashboard from scratch, but we also offer numerous [dashboard templates](/templates) for tracking things like [website metrics](/templates/website-dashboard), [product health metrics](/templates/health-dashboard), and [metrics for large language models](/docs/llm-analytics).
33
33
@@ -124,3 +124,89 @@ To do so, click the dropdown arrow next to refresh button, turn on auto refresh
124
124
This is useful if you have a PostHog dashboard on a TV screen for others to see.
125
125
126
126
**Important:** Auto refresh only works when the browser tab is active.
For teams practicing infrastructure-as-code, you can manage PostHog dashboards and insights using the [PostHog Terraform Provider](https://registry.terraform.io/providers/PostHog/posthog/latest).
135
+
136
+
This enables:
137
+
138
+
-**Version-controlled analytics** - Dashboard and insight definitions stored in git
139
+
-**Consistent environments** - Deploy the same dashboards across projects
140
+
-**CI/CD integration** - Automate analytics infrastructure alongside your application
141
+
142
+
### Exporting existing dashboards
143
+
144
+
To get started quickly, you can export your existing dashboards as Terraform code using the **Manage with Terraform** button.
145
+
146
+
> To enable this feature, opt in via [Feature Previews](https://app.posthog.com/settings/user-feature-previews) in your settings.
147
+
148
+
Once enabled, you'll see a "Manage with Terraform" button on:
149
+
-**Dashboard pages** - Exports the entire dashboard including all insights, alerts, and hog functions
150
+
-**Insight detail pages** - Exports the individual insight with its associated alerts and hog functions
151
+
152
+
Click the button to generate HCL code that you can copy directly into your Terraform configuration. This makes it easy to bring existing dashboards under version control without manually recreating them.
153
+
154
+
### Installation
155
+
156
+
Add the provider to your Terraform configuration:
157
+
158
+
```hcl
159
+
terraform {
160
+
required_providers {
161
+
posthog = {
162
+
source = "PostHog/posthog"
163
+
}
164
+
}
165
+
}
166
+
167
+
provider "posthog" {
168
+
host = "https://us.posthog.com" # or https://eu.posthog.com
169
+
api_key = var.posthog_api_key # Your personal API key
170
+
project_id = var.posthog_project_id
171
+
}
172
+
```
173
+
174
+
For production use, we recommend pinning to a specific version. See the [Terraform Registry](https://registry.terraform.io/providers/PostHog/posthog/latest) for the latest version.
175
+
176
+
### Example: Creating a dashboard
177
+
178
+
```hcl
179
+
resource "posthog_dashboard" "team_metrics" {
180
+
name = "[Team: Platform] Key Metrics"
181
+
description = "Key metrics for the platform team"
182
+
pinned = true
183
+
tags = ["managed-by:terraform"]
184
+
}
185
+
```
186
+
187
+
### Example: Creating an insight
188
+
189
+
```hcl
190
+
resource "posthog_insight" "pageview_count" {
191
+
derived_name = "Pageview count"
192
+
query_json = jsonencode({
193
+
"kind": "InsightVizNode",
194
+
"source": {
195
+
"kind": "TrendsQuery",
196
+
"series": [
197
+
{
198
+
"kind": "EventsNode",
199
+
"name": "$pageview",
200
+
"event": "$pageview",
201
+
"math": "total"
202
+
}
203
+
],
204
+
"trendsFilter": {},
205
+
"version": 2
206
+
}
207
+
})
208
+
tags = ["managed-by:terraform"]
209
+
}
210
+
```
211
+
212
+
For the full list of supported resources and configuration options, see the [Terraform Registry documentation](https://registry.terraform.io/providers/PostHog/posthog/latest/docs).
Copy file name to clipboardExpand all lines: contents/docs/product-analytics/insights.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,3 +130,5 @@ You can then customize the insight and save it. You can change the type of insig
130
130
2. By clicking "Add insight" in the top right of any [dashboard](/docs/product-analytics/dashboards). Insights you create this way are automatically added to the dashboard.
131
131
132
132
3. Inside any notebook. Insights created in a Notebook aren't saved to 'Your Insights' automatically – see our Notebook docs for more.
133
+
134
+
4. Using [Terraform](/docs/product-analytics/dashboards#managing-dashboards-with-terraform) to manage insights as infrastructure-as-code.
0 commit comments