Skip to content

Commit 5d05d7d

Browse files
authored
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
1 parent 1c5622a commit 5d05d7d

File tree

12 files changed

+119
-1
lines changed

12 files changed

+119
-1
lines changed

contents/docs/libraries.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ This document outlines all of our current client-side and server-side libraries,
1414
>**Note:** Session recording and autocapture are not possible in server libraries.
1515
1616
<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.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import CalloutBox from 'components/Docs/CalloutBox'
2+
3+
<CalloutBox icon="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.
8+
9+
</CalloutBox>

contents/docs/product-analytics/dashboards.mdx

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const dashboardfiltersDark = "https://res.cloudinary.com/dmukukwp6/video/
2727

2828
Dashboards are the easiest way to track all your most important product and performance metrics.
2929

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

3232
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).
3333

@@ -124,3 +124,89 @@ To do so, click the dropdown arrow next to refresh button, turn on auto refresh
124124
This is useful if you have a PostHog dashboard on a TV screen for others to see.
125125

126126
**Important:** Auto refresh only works when the browser tab is active.
127+
128+
## Managing dashboards with Terraform
129+
130+
import TerraformBeta from './_snippets/terraform-beta.mdx'
131+
132+
<TerraformBeta />
133+
134+
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).

contents/docs/product-analytics/insights.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,5 @@ You can then customize the insight and save it. You can change the type of insig
130130
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.
131131

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

src/hooks/competitorData/amplitude.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ export const amplitude = {
400400
proxies: false,
401401
sdks: false,
402402
sql: false,
403+
terraform: false,
403404
},
404405
tools: {
405406
cms: '',

src/hooks/competitorData/heap.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export const heap = {
267267
proxies: false,
268268
sdks: false,
269269
sql: false,
270+
terraform: false,
270271
},
271272
tools: {
272273
cms: '',

src/hooks/competitorData/mixpanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ export const mixpanel = {
421421
proxies: false,
422422
sdks: false,
423423
sql: false,
424+
terraform: false,
424425
},
425426
tools: {
426427
cms: '',

src/hooks/competitorData/pendo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export const pendo = {
216216
sdks: false,
217217
server_side_sdks: true,
218218
sql: false,
219+
terraform: false,
219220
},
220221
tools: {
221222
cms: '',

src/hooks/competitorData/posthog.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ export const posthog = {
638638
sdks: '14',
639639
server_side_sdks: true,
640640
sql: true,
641+
terraform: true,
641642
tv_sdks: false,
642643
},
643644
tools: {

src/hooks/competitorData/statsig.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ export const statsig = {
297297
sdks: false,
298298
server_side_sdks: false,
299299
sql: false,
300+
terraform: true,
300301
},
301302
tools: {
302303
cms: '',

0 commit comments

Comments
 (0)