Skip to content

Commit 05ce14e

Browse files
feat: Added examples of export fields and filters in the main documentation. (#2)
1 parent 9121145 commit 05ce14e

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

docs/index.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,68 @@ Go into the workspace you want to manage with Terraform and get the ID from the
3636
Get resource IDs from the Funnel app as well. Above the table listing of resources there is a "Choose column" button where you can add the column "ID" that contains the resource IDs.
3737
You could also go into the resource you want to manage with Terraform and get the ID from the URL. The URL will look something like this: `https://app.funnel.io/#/account/WORKSPACE_ID/RESOURCE_TYPE/RESOURCE_ID`.
3838

39+
## Exports
40+
41+
Exports are created with the `funnel_<type>_export` resource. The available types are `bigquery`, `snowflake` and `gcs`. All the fields outside of the `destination` block are shared with the other export types.
42+
43+
## Fields
44+
45+
The data source `funnel_export_field` can be used to get the fields for an export. Lists of fields are then used in the `fields` block of the export resources.
46+
47+
The "export_name" will be "Date" as fallback because that's the name of the field in Funnel:
48+
```hcl
49+
data "funnel_export_field" "date_field" {
50+
workspace = local.workspace_id
51+
id = local.field_date_id
52+
}
53+
```
54+
55+
Setting a new "export_name" for the field to use as the column name in the export:
56+
```hcl
57+
data "funnel_export_field" "adtriba_brand_field" {
58+
workspace = local.workspace_id
59+
id = local.field_adtriba_brand_id
60+
export_name = "TF_ADTRIBA_BRAND"
61+
}
62+
```
63+
64+
Setting both a new "export_name" and "export_type" for the field to use as the column name and type in the export:
65+
```hcl
66+
data "funnel_export_field" "clicks_field" {
67+
workspace = local.workspace_id
68+
id = local.field_clicks_id
69+
export_name = "TF_CLICKS"
70+
export_type = "BIGINT"
71+
}
72+
```
73+
74+
# Filters
75+
76+
Filters are used to filter the data that is exported. They are used in the `filters` block of the export resources.
77+
Example of an AND filter of two filters on two fields:
78+
79+
```hcl
80+
filters = [
81+
{
82+
field_id = local.field_adtriba_brand_id
83+
or = [
84+
{
85+
operation = "contains"
86+
value = "company_a"
87+
},
88+
{
89+
operation = "notcontains"
90+
value = "company_b"
91+
}]
92+
},
93+
{
94+
field_id = local.field_date_id
95+
operation = "gt"
96+
value = "2025"
97+
}
98+
]
99+
```
100+
39101
## Potential errors
40102

41103
### Conflicting resources

templates/index.md.tmpl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,68 @@ Go into the workspace you want to manage with Terraform and get the ID from the
3636
Get resource IDs from the Funnel app as well. Above the table listing of resources there is a "Choose column" button where you can add the column "ID" that contains the resource IDs.
3737
You could also go into the resource you want to manage with Terraform and get the ID from the URL. The URL will look something like this: `https://app.funnel.io/#/account/WORKSPACE_ID/RESOURCE_TYPE/RESOURCE_ID`.
3838

39+
## Exports
40+
41+
Exports are created with the `funnel_<type>_export` resource. The available types are `bigquery`, `snowflake` and `gcs`. All the fields outside of the `destination` block are shared with the other export types.
42+
43+
## Fields
44+
45+
The data source `funnel_export_field` can be used to get the fields for an export. Lists of fields are then used in the `fields` block of the export resources.
46+
47+
The "export_name" will be "Date" as fallback because that's the name of the field in Funnel:
48+
```hcl
49+
data "funnel_export_field" "date_field" {
50+
workspace = local.workspace_id
51+
id = local.field_date_id
52+
}
53+
```
54+
55+
Setting a new "export_name" for the field to use as the column name in the export:
56+
```hcl
57+
data "funnel_export_field" "adtriba_brand_field" {
58+
workspace = local.workspace_id
59+
id = local.field_adtriba_brand_id
60+
export_name = "TF_ADTRIBA_BRAND"
61+
}
62+
```
63+
64+
Setting both a new "export_name" and "export_type" for the field to use as the column name and type in the export:
65+
```hcl
66+
data "funnel_export_field" "clicks_field" {
67+
workspace = local.workspace_id
68+
id = local.field_clicks_id
69+
export_name = "TF_CLICKS"
70+
export_type = "BIGINT"
71+
}
72+
```
73+
74+
# Filters
75+
76+
Filters are used to filter the data that is exported. They are used in the `filters` block of the export resources.
77+
Example of an AND filter of two filters on two fields:
78+
79+
```hcl
80+
filters = [
81+
{
82+
field_id = local.field_adtriba_brand_id
83+
or = [
84+
{
85+
operation = "contains"
86+
value = "company_a"
87+
},
88+
{
89+
operation = "notcontains"
90+
value = "company_b"
91+
}]
92+
},
93+
{
94+
field_id = local.field_date_id
95+
operation = "gt"
96+
value = "2025"
97+
}
98+
]
99+
```
100+
39101
## Potential errors
40102

41103
### Conflicting resources

0 commit comments

Comments
 (0)