Skip to content

Commit 06d637f

Browse files
committed
Fix variable updates
1 parent 5382eba commit 06d637f

40 files changed

+3027
-1051
lines changed

.speakeasy/gen.lock

Lines changed: 1497 additions & 104 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ original_modified.yaml: original.yaml overlay.yaml
1010
overlay.yaml:
1111
speakeasy overlay compare -s original.yaml -s original_modified.yaml > overlay.yaml
1212

13-
speakeasy:
13+
speakeasy: original_modified.yaml
1414
$(eval TMP := $(shell mktemp -d))
15-
curl https://docs.api.epilot.io/template-variables.yaml > $(TMP)/openapi.yaml
15+
cp original_modified.yaml $(TMP)/openapi.yaml
1616
speakeasy overlay apply -s $(TMP)/openapi.yaml -o overlay.yaml > $(TMP)/final.yaml
1717
speakeasy generate sdk --lang terraform -o . -s $(TMP)/final.yaml
1818

README.md

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Template Variables API: API to provide variables for email and document template
3232
* [Testing the provider locally](#testing-the-provider-locally)
3333
<!-- End Table of Contents [toc] -->
3434

35-
<!-- Start Installation [installation] -->
36-
## Installation
35+
<!-- Start SDK Installation [installation] -->
36+
## SDK Installation
3737

3838
To install this provider, copy and paste this code into your Terraform configuration. Then, run `terraform init`.
3939

@@ -42,7 +42,7 @@ terraform {
4242
required_providers {
4343
epilot-custom-variable = {
4444
source = "epilot-dev/epilot-custom-variable"
45-
version = "1.0.2"
45+
version = "1.1.2"
4646
}
4747
}
4848
}
@@ -51,28 +51,25 @@ provider "epilot-custom-variable" {
5151
# Configuration options
5252
}
5353
```
54-
<!-- End Installation [installation] -->
54+
<!-- End SDK Installation [installation] -->
5555

56-
<!-- Start Available Resources and Data Sources [operations] -->
57-
## Available Resources and Data Sources
56+
<!-- Start Available Resources and Operations [operations] -->
57+
## Available Resources and Operations
5858

59-
### Resources
6059

61-
* [epilot-custom-variable_custom_variable](docs/resources/custom_variable.md)
62-
### Data Sources
60+
<!-- End Available Resources and Operations [operations] -->
6361

64-
* [epilot-custom-variable_custom_variable](docs/data-sources/custom_variable.md)
65-
<!-- End Available Resources and Data Sources [operations] -->
62+
<!-- Start SDK Example Usage [usage] -->
63+
## SDK Example Usage
6664

67-
<!-- Start Testing the provider locally [usage] -->
68-
## Testing the provider locally
69-
70-
#### Local Provider
65+
### Testing the provider locally
7166

7267
Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally.
7368

7469
This also allows for debuggers (e.g. delve) to be attached to the provider.
7570

71+
### Example
72+
7673
```sh
7774
go run main.go --debug
7875
# Copy the TF_REATTACH_PROVIDERS env var
@@ -81,30 +78,7 @@ cd examples/your-example
8178
TF_REATTACH_PROVIDERS=... terraform init
8279
TF_REATTACH_PROVIDERS=... terraform apply
8380
```
84-
85-
#### Compiled Provider
86-
87-
Terraform allows you to use local provider builds by setting a `dev_overrides` block in a configuration file called `.terraformrc`. This block overrides all other configured installation methods.
88-
89-
1. Execute `go build` to construct a binary called `terraform-provider-epilot-custom-variable`
90-
2. Ensure that the `.terraformrc` file is configured with a `dev_overrides` section such that your local copy of terraform can see the provider binary
91-
92-
Terraform searches for the `.terraformrc` file in your home directory and applies any configuration settings you set.
93-
94-
```
95-
provider_installation {
96-
97-
dev_overrides {
98-
"registry.terraform.io/epilot-dev/epilot-custom-variable" = "<PATH>"
99-
}
100-
101-
# For all other providers, install them directly from their origin provider
102-
# registries as normal. If you omit this, Terraform will _only_ use
103-
# the dev_overrides block, and so no other providers will be available.
104-
direct {}
105-
}
106-
```
107-
<!-- End Testing the provider locally [usage] -->
81+
<!-- End SDK Example Usage [usage] -->
10882

10983
<!-- Placeholder for Future Speakeasy SDK Sections -->
11084

docs/data-sources/custom_variable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ data "epilot-custom-variable_custom_variable" "my_customvariable" {
3636
- `name` (String) Custom variable name
3737
- `tags` (List of String) The tags of custom variable
3838
- `template` (String) Handlebar template that used to generate the variable content
39-
- `type` (String) Custom variable type
39+
- `type` (String) Custom variable type. must be one of ["order_table", "custom", "journey_link"]
4040
- `updated_at` (String) Last update time
4141
- `updated_by` (String) Updated by

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ terraform {
1717
required_providers {
1818
epilot-custom-variable = {
1919
source = "epilot-dev/epilot-custom-variable"
20-
version = "1.0.2"
20+
version = "1.1.2"
2121
}
2222
}
2323
}

docs/resources/custom_variable.md

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,38 @@ CustomVariable Resource
1515
```terraform
1616
resource "epilot-custom-variable_custom_variable" "my_customvariable" {
1717
config = "{ \"see\": \"documentation\" }"
18-
created_at = "2022-04-19T12:41:43.662Z"
19-
created_by = 100042
2018
helper_logic = "return param1 * param2;"
21-
helper_params = [
22-
"..."
23-
]
24-
id = "rbse777b-3cf8-4bff-bb0c-253fd1123250"
25-
key = "my_custom_table"
26-
name = "My Custom table"
27-
tags = [
28-
"..."
29-
]
30-
template = "<table style=\"table-layout: fixed;width: 100%;max-width: 1000px;border-collapse: collapse;\">\n <thead>\n <tr style=\"height: 48px;border-bottom: 1px solid #D5E1ED;\">\n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n <th style=\"{{makeStyle @root.table_config.header.style}};{{makeStyle column.style}};\">{{column._label}}</th>\n {{/if}}\n {{/each}}\n </tr>\n </thead>\n <tbody style=\"vertical-align: baseline !important;font-weight: 400;font-size: 12px;position: relative;\">\n <!-- Start rendering products -->\n {{#each order.products as |product|}}\n {{#if @last}}\n <tr style=\"height: 48px;;font-size:14px;border-bottom: 1px solid #D5E1ED;\">\n {{else}}\n <tr style=\"height: 48px;;font-size:14px;\">\n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n <!-- Item -->\n <td style=\"{{makeStyle @root.table_config.body.product_name.style}}\">\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n <br>\n <span style=\"{{makeStyle @root.table_config.body.price_description.style}}\">{{product.price.description}}</span>\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n <br>\n <span style=\"{{makeStyle @root.table_config.body.product_description.style}}\">{{product.description}}</span>\n {{/if}}\n </td>\n {{/if}}\n {{#if (eq column.id 'quantity')}}\n <!-- Quantity -->\n <td style=\"{{makeStyle @root.table_config.body.quantity.style}}\">{{product.price.quantity}}\n </td>\n {{/if}}\n {{#if (eq column.id 'tax')}}\n <!-- Tax -->\n <td style=\"{{makeStyle @root.table_config.body.tax.style}}\">\n {{product.price.tax_rate}}\n </td>\n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n <!-- Unit amount -->\n <td style=\"{{makeStyle @root.table_config.body.unit_amount.style}}\">\n {{product.price.unit_amount_net}}\n </td>\n {{/if}}\n {{#if (eq column.id 'net_total')}}\n <!-- Amount Subtotal -->\n <td style=\"{{makeStyle @root.table_config.body.net_total.style}}\">\n {{product.price.amount_subtotal}}\n </td>\n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n <!-- Tax amount-->\n <td style=\"{{makeStyle @root.table_config.body.amount_tax.style}}\">\n {{product.price.amount_tax}}\n </td>\n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n <!-- Gross total -->\n <td style=\"{{makeStyle @root.table_config.body.gross_total.style}}\">\n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n <br>\n <span style=\"{{makeStyle @root.table_config.body.payment_type.style}}\">{{product.price.billing_period}}</span>\n {{/if}}\n {{/if}}\n </td>\n {{/if}}\n {{/if}}\n {{/each}}\n </tr>\n {{/each}}\n <!-- Finish rendering products -->\n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n <tr style=\"height: 48px;font-size: 14px;\">\n <td style=\"padding-top: 16px; padding-bottom: 8px; border: none !important; vertical-align: top;\" colspan=\"{{calculate_colspan @root.table_config}}\"></td>\n {{#if @root.table_config.footer.payment_type.enable}}\n <td style=\"{{makeStyle @root.table_config.footer.payment_type.style}}\" colspan=\"2\">{{item.billing_period}}</td>\n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n <td style=\"{{makeStyle @root.table_config.footer.net_total.style}}\">{{item.amount_subtotal}}</td>\n {{/if}}\n {{/if}}\n <td style=\"{{makeStyle @root.table_config.footer.gross_total.style}}\">{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n <br>\n <span style=\"{{makeStyle @root.table_config.footer.amount_tax.style}}\">{{item.full_amount_tax}}</span>\n {{/if}}\n </td>\n </tr>\n {{/each}}\n {{/if}}\n <tr style=\"height:16px !important;\"></tr>\n </tbody>\n</table>\n"
31-
type = "custom"
32-
updated_at = "2022-04-20T12:41:43.662Z"
33-
updated_by = 100042
19+
key = "my_custom_table"
20+
name = "My Custom table"
21+
template = "<table style=\"table-layout: fixed;width: 100%;max-width: 1000px;border-collapse: collapse;\">\n <thead>\n <tr style=\"height: 48px;border-bottom: 1px solid #D5E1ED;\">\n {{#each table_config.header.columns as |column|}}\n {{#if column.enable}}\n <th style=\"{{makeStyle @root.table_config.header.style}};{{makeStyle column.style}};\">{{column._label}}</th>\n {{/if}}\n {{/each}}\n </tr>\n </thead>\n <tbody style=\"vertical-align: baseline !important;font-weight: 400;font-size: 12px;position: relative;\">\n <!-- Start rendering products -->\n {{#each order.products as |product|}}\n {{#if @last}}\n <tr style=\"height: 48px;;font-size:14px;border-bottom: 1px solid #D5E1ED;\">\n {{else}}\n <tr style=\"height: 48px;;font-size:14px;\">\n {{/if}}\n {{#each @root.table_config.header.columns as |column|}}\n {{#if column.enable}}\n {{#if (eq column.id 'item')}}\n <!-- Item -->\n <td style=\"{{makeStyle @root.table_config.body.product_name.style}}\">\n {{#if @root.table_config.body.product_name.enable}}\n {{product.name}}\n {{/if}}\n {{#if @root.table_config.body.price_description.enable}}\n <br>\n <span style=\"{{makeStyle @root.table_config.body.price_description.style}}\">{{product.price.description}}</span>\n {{/if}}\n {{#if @root.table_config.body.product_description.enable}}\n <br>\n <span style=\"{{makeStyle @root.table_config.body.product_description.style}}\">{{product.description}}</span>\n {{/if}}\n </td>\n {{/if}}\n {{#if (eq column.id 'quantity')}}\n <!-- Quantity -->\n <td style=\"{{makeStyle @root.table_config.body.quantity.style}}\">{{product.price.quantity}}\n </td>\n {{/if}}\n {{#if (eq column.id 'tax')}}\n <!-- Tax -->\n <td style=\"{{makeStyle @root.table_config.body.tax.style}}\">\n {{product.price.tax_rate}}\n </td>\n {{/if}}\n {{#if (eq column.id 'unit_amount')}}\n <!-- Unit amount -->\n <td style=\"{{makeStyle @root.table_config.body.unit_amount.style}}\">\n {{product.price.unit_amount_net}}\n </td>\n {{/if}}\n {{#if (eq column.id 'net_total')}}\n <!-- Amount Subtotal -->\n <td style=\"{{makeStyle @root.table_config.body.net_total.style}}\">\n {{product.price.amount_subtotal}}\n </td>\n {{/if}}\n {{#if (eq column.id 'amount_tax')}}\n <!-- Tax amount-->\n <td style=\"{{makeStyle @root.table_config.body.amount_tax.style}}\">\n {{product.price.amount_tax}}\n </td>\n {{/if}}\n {{#if (eq column.id 'gross_total')}}\n <!-- Gross total -->\n <td style=\"{{makeStyle @root.table_config.body.gross_total.style}}\">\n {{product.price.amount_total}}\n {{#if @root.table_config.body.payment_type.enable}}\n {{#if (eq product.price.type 'recurring')}}\n <br>\n <span style=\"{{makeStyle @root.table_config.body.payment_type.style}}\">{{product.price.billing_period}}</span>\n {{/if}}\n {{/if}}\n </td>\n {{/if}}\n {{/if}}\n {{/each}}\n </tr>\n {{/each}}\n <!-- Finish rendering products -->\n {{#if table_config.footer.gross_total.enable}}\n {{#each order.total_details.recurrences as |item|}}\n <tr style=\"height: 48px;font-size: 14px;\">\n <td style=\"padding-top: 16px; padding-bottom: 8px; border: none !important; vertical-align: top;\" colspan=\"{{calculate_colspan @root.table_config}}\"></td>\n {{#if @root.table_config.footer.payment_type.enable}}\n <td style=\"{{makeStyle @root.table_config.footer.payment_type.style}}\" colspan=\"2\">{{item.billing_period}}</td>\n {{/if}}\n {{#if (isColumnEnabled @root.table_config 'net_total')}}\n {{#if @root.table_config.footer.net_total.enable}}\n <td style=\"{{makeStyle @root.table_config.footer.net_total.style}}\">{{item.amount_subtotal}}</td>\n {{/if}}\n {{/if}}\n <td style=\"{{makeStyle @root.table_config.footer.gross_total.style}}\">{{item.amount_total}}\n {{#if @root.table_config.footer.amount_tax.enable}}\n <br>\n <span style=\"{{makeStyle @root.table_config.footer.amount_tax.style}}\">{{item.full_amount_tax}}</span>\n {{/if}}\n </td>\n </tr>\n {{/each}}\n {{/if}}\n <tr style=\"height:16px !important;\"></tr>\n </tbody>\n</table>\n"
22+
type = "order_table"
3423
}
3524
```
3625

3726
<!-- schema generated by tfplugindocs -->
3827
## Schema
3928

29+
### Required
30+
31+
- `key` (String) The key which is used for Handlebar variable syntax {{"{{"}}key{{"}}"}}
32+
- `template` (String) Handlebar template that used to generate the variable content
33+
4034
### Optional
4135

42-
- `config` (String) Requires replacement if changed.; Parsed as JSON.
43-
- `created_at` (String) Creation time. Requires replacement if changed.
44-
- `created_by` (String) Created by. Requires replacement if changed.
45-
- `helper_logic` (String) The helper function logic. Requires replacement if changed.
46-
- `helper_params` (List of String) The helper function parameter's names. Requires replacement if changed.
47-
- `id` (String) ID. Requires replacement if changed.
48-
- `key` (String) The key which is used for Handlebar variable syntax {{"{{"}}key{{"}}"}}. Requires replacement if changed.
49-
- `name` (String) Custom variable name. Requires replacement if changed.
50-
- `tags` (List of String) The tags of custom variable. Requires replacement if changed.
51-
- `template` (String) Handlebar template that used to generate the variable content. Requires replacement if changed.
52-
- `type` (String) Custom variable type. must be one of ["order_table", "custom", "journey_link"]; Requires replacement if changed.
53-
- `updated_at` (String) Last update time. Requires replacement if changed.
54-
- `updated_by` (String) Updated by. Requires replacement if changed.
36+
- `config` (String) Parsed as JSON.
37+
- `helper_logic` (String) The helper function logic
38+
- `helper_params` (List of String) The helper function parameter's names
39+
- `name` (String) Custom variable name
40+
- `tags` (List of String) The tags of custom variable
41+
- `type` (String) Custom variable type. must be one of ["order_table", "custom", "journey_link"]
42+
43+
### Read-Only
44+
45+
- `created_at` (String) Creation time
46+
- `created_by` (String) Created by
47+
- `id` (String) Custom vairable ID
48+
- `updated_at` (String) Last update time
49+
- `updated_by` (String) Updated by
5550

5651
## Import
5752

examples/provider/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
epilot-custom-variable = {
44
source = "epilot-dev/epilot-custom-variable"
5-
version = "1.0.2"
5+
version = "1.1.2"
66
}
77
}
88
}

0 commit comments

Comments
 (0)