Skip to content

Commit

Permalink
fix: make id non readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateus Nardo committed Dec 6, 2024
1 parent 06d637f commit 6c1df26
Show file tree
Hide file tree
Showing 30 changed files with 1,000 additions and 1,798 deletions.
1,563 changes: 86 additions & 1,477 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

63 changes: 47 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@ Template Variables API: API to provide variables for email and document template

<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [epilot-custom-variable](#epilot-custom-variable)
* [🏗 **Welcome to your new Terraform Provider!** 🏗](#welcome-to-your-new-terraform-provider)
* [Installation](#installation)
* [Available Resources and Data Sources](#available-resources-and-data-sources)
* [Testing the provider locally](#testing-the-provider-locally)
* [Development](#development)
* [Contributions](#contributions)

* [Installation](#installation)
* [Available Resources and Data Sources](#available-resources-and-data-sources)
* [Testing the provider locally](#testing-the-provider-locally)
<!-- End Table of Contents [toc] -->

<!-- Start SDK Installation [installation] -->
## SDK Installation
<!-- Start Installation [installation] -->
## Installation

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

Expand All @@ -42,7 +47,7 @@ terraform {
required_providers {
epilot-custom-variable = {
source = "epilot-dev/epilot-custom-variable"
version = "1.1.2"
version = "1.2.0"
}
}
}
Expand All @@ -51,25 +56,28 @@ provider "epilot-custom-variable" {
# Configuration options
}
```
<!-- End SDK Installation [installation] -->
<!-- End Installation [installation] -->

<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations
<!-- Start Available Resources and Data Sources [operations] -->
## Available Resources and Data Sources

### Resources

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

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

### Testing the provider locally
<!-- Start Testing the provider locally [usage] -->
## Testing the provider locally

#### Local Provider

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

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

### Example

```sh
go run main.go --debug
# Copy the TF_REATTACH_PROVIDERS env var
Expand All @@ -78,7 +86,30 @@ cd examples/your-example
TF_REATTACH_PROVIDERS=... terraform init
TF_REATTACH_PROVIDERS=... terraform apply
```
<!-- End SDK Example Usage [usage] -->

#### Compiled Provider

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.

1. Execute `go build` to construct a binary called `terraform-provider-epilot-custom-variable`
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

Terraform searches for the `.terraformrc` file in your home directory and applies any configuration settings you set.

```
provider_installation {
dev_overrides {
"registry.terraform.io/epilot-dev/epilot-custom-variable" = "<PATH>"
}
# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}
```
<!-- End Testing the provider locally [usage] -->

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

Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/custom_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ data "epilot-custom-variable_custom_variable" "my_customvariable" {
- `name` (String) Custom variable name
- `tags` (List of String) The tags of custom variable
- `template` (String) Handlebar template that used to generate the variable content
- `type` (String) Custom variable type. must be one of ["order_table", "custom", "journey_link"]
- `type` (String) Custom variable type
- `updated_at` (String) Last update time
- `updated_by` (String) Updated by
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ terraform {
required_providers {
epilot-custom-variable = {
source = "epilot-dev/epilot-custom-variable"
version = "1.1.2"
version = "1.2.0"
}
}
}
Expand Down
35 changes: 20 additions & 15 deletions docs/resources/custom_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,41 @@ CustomVariable Resource
```terraform
resource "epilot-custom-variable_custom_variable" "my_customvariable" {
config = "{ \"see\": \"documentation\" }"
created_at = "2022-04-19T12:41:43.662Z"
created_by = 100042
helper_logic = "return param1 * param2;"
key = "my_custom_table"
name = "My Custom table"
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"
type = "order_table"
helper_params = [
"..."
]
id = "rbse777b-3cf8-4bff-bb0c-253fd1123250"
key = "my_custom_table"
name = "My Custom table"
tags = [
"..."
]
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"
type = "custom"
updated_at = "2022-04-20T12:41:43.662Z"
updated_by = 100042
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `key` (String) The key which is used for Handlebar variable syntax {{"{{"}}key{{"}}"}}
- `template` (String) Handlebar template that used to generate the variable content

### Optional

- `config` (String) Parsed as JSON.
- `created_at` (String) Creation time
- `created_by` (String) Created by
- `helper_logic` (String) The helper function logic
- `helper_params` (List of String) The helper function parameter's names
- `id` (String) ID
- `key` (String) The key which is used for Handlebar variable syntax {{"{{"}}key{{"}}"}}
- `name` (String) Custom variable name
- `tags` (List of String) The tags of custom variable
- `template` (String) Handlebar template that used to generate the variable content
- `type` (String) Custom variable type. must be one of ["order_table", "custom", "journey_link"]

### Read-Only

- `created_at` (String) Creation time
- `created_by` (String) Created by
- `id` (String) Custom vairable ID
- `updated_at` (String) Last update time
- `updated_by` (String) Updated by

Expand Down
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
epilot-custom-variable = {
source = "epilot-dev/epilot-custom-variable"
version = "1.1.2"
version = "1.2.0"
}
}
}
Expand Down
Loading

0 comments on commit 6c1df26

Please sign in to comment.