Skip to content

Commit 66f653c

Browse files
authored
Merge tracking plans and rules (#34)
1 parent 938e8e4 commit 66f653c

18 files changed

+591
-981
lines changed

docs/data-sources/tracking_plan.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ data "segment_tracking_plan" "example" {
3131
- `created_at` (String) The timestamp of this Tracking Plan's creation.
3232
- `description` (String) The Tracking Plan's description.
3333
- `name` (String) The Tracking Plan's name.
34+
- `rules` (Attributes Set) The list of Tracking Plan rules. Currently limited to 200 rules. (see [below for nested schema](#nestedatt--rules))
3435
- `slug` (String) URL-friendly slug of this Tracking Plan.
3536
- `type` (String) The Tracking Plan's type.
3637
- `updated_at` (String) The timestamp of the last change to the Tracking Plan.
38+
39+
<a id="nestedatt--rules"></a>
40+
### Nested Schema for `rules`
41+
42+
Read-Only:
43+
44+
- `created_at` (String) The timestamp of this rule's creation.
45+
- `deprecated_at` (String) The timestamp of this rule's deprecation.
46+
- `json_schema` (String) JSON Schema of this rule.
47+
- `key` (String) Key to this rule (free-form string like 'Button clicked').
48+
- `type` (String) The type for this Tracking Plan rule.
49+
50+
Enum: "COMMON" "GROUP" "IDENTIFY" "PAGE" "SCREEN" "TRACK"
51+
- `updated_at` (String) The timestamp of this rule's last change.
52+
- `version` (Number) Version of this rule.

docs/data-sources/tracking_plan_rules.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

docs/resources/tracking_plan.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,23 @@ description: |-
1515
```terraform
1616
# Configures a specific tracking plan
1717
resource "segment_tracking_plan" "my_tracking_plan" {
18-
name = "my-tracking-plan"
19-
type = "LIVE"
18+
name = "my-tracking-plan"
19+
type = "LIVE"
20+
description = "My Tracking Plan Description"
21+
rules = [
22+
{
23+
key = "Add Rule"
24+
type = "TRACK"
25+
version = 1
26+
json_schema = jsonencode({
27+
"properties" : {
28+
"context" : {},
29+
"traits" : {},
30+
"properties" : {}
31+
}
32+
})
33+
}
34+
]
2035
}
2136
```
2237

@@ -26,6 +41,12 @@ resource "segment_tracking_plan" "my_tracking_plan" {
2641
### Required
2742

2843
- `name` (String) The Tracking Plan's name.
44+
- `rules` (Attributes Set) The list of Tracking Plan rules.
45+
46+
Due to Terraform resource limitations, this list might not show an exact representation of how the Tracking Plan interprets each rule.
47+
To see an exact representation of this Tracking Plan's rules, please use the data source.
48+
49+
This field is currently limited to 200 items. (see [below for nested schema](#nestedatt--rules))
2950
- `type` (String) The Tracking Plan's type.
3051

3152
### Optional
@@ -38,3 +59,18 @@ resource "segment_tracking_plan" "my_tracking_plan" {
3859
- `id` (String) The Tracking Plan's identifier.
3960
- `slug` (String) URL-friendly slug of this Tracking Plan.
4061
- `updated_at` (String) The timestamp of the last change to the Tracking Plan.
62+
63+
<a id="nestedatt--rules"></a>
64+
### Nested Schema for `rules`
65+
66+
Required:
67+
68+
- `json_schema` (String) JSON Schema of this rule.
69+
- `type` (String) The type for this Tracking Plan rule.
70+
71+
Enum: "COMMON" "GROUP" "IDENTIFY" "PAGE" "SCREEN" "TRACK"
72+
- `version` (Number) Version of this rule.
73+
74+
Optional:
75+
76+
- `key` (String) Key to this rule (free-form string like 'Button clicked').

docs/resources/tracking_plan_rules.md

Lines changed: 0 additions & 82 deletions
This file was deleted.

examples/data-sources/segment_tracking_plan_rules/data-source.tf

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Configures a specific tracking plan
22
resource "segment_tracking_plan" "my_tracking_plan" {
3-
name = "my-tracking-plan"
4-
type = "LIVE"
5-
}
3+
name = "my-tracking-plan"
4+
type = "LIVE"
5+
description = "My Tracking Plan Description"
6+
rules = [
7+
{
8+
key = "Add Rule"
9+
type = "TRACK"
10+
version = 1
11+
json_schema = jsonencode({
12+
"properties" : {
13+
"context" : {},
14+
"traits" : {},
15+
"properties" : {}
16+
}
17+
})
18+
}
19+
]
20+
}

examples/resources/segment_tracking_plan_rules/resource.tf

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)