diff --git a/.idea/terraform-provider-commercelayer.iml b/.idea/terraform-provider-commercelayer.iml
index 39652b2..55ae9c9 100644
--- a/.idea/terraform-provider-commercelayer.iml
+++ b/.idea/terraform-provider-commercelayer.iml
@@ -3,7 +3,7 @@
-
+
diff --git a/README.md b/README.md
index 6729ef5..36802fc 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,42 @@
The Commercelayer terraform provider allows you to configure your [Commercelayer shops](https://commercelayer.io/) with
infrastructure-as-code principles.
+## Currently supported resources
+
+Currently, the checked resources are supported. Support for additional resources will come when they are required in
+projects, or contributed.
+
+- [x] Address
+- [ ] Adyen payment gateway
+- [ ] Avalara tax calculator
+- [ ] Bing Geocoder
+- [ ] Braintree payment gateway
+- [ ] Checkout.com payment gateway
+- [x] Customer group
+- [ ] Delivery lead times
+- [x] External payment gateway
+- [x] External tax calculator
+- [ ] Google Geocoder
+- [x] Inventory model
+- [x] Inventory return location
+- [x] Inventory stock location
+- [ ] Klarna payment gateway
+- [ ] Manual payment gateway
+- [ ] Manual tax calculator
+- [x] Market
+- [x] Merchant
+- [ ] Paypal payment gateway
+- [ ] Payment method
+- [x] Price list
+- [x] Shipping category
+- [x] Shipping method
+- [x] Shipping zone
+- [x] Stock location
+- [ ] Stripe payment gateway
+- [ ] Taxjar tax calculator
+- [ ] Tax rules
+- [x] Webhook
+
## Usage
Add the provider to your terraform project
diff --git a/commercelayer/resource_webhook.go b/commercelayer/resource_webhook.go
index 221e0bb..68f2122 100644
--- a/commercelayer/resource_webhook.go
+++ b/commercelayer/resource_webhook.go
@@ -61,7 +61,7 @@ func resourceWebhook() *schema.Resource {
Required: true,
},
"include_resources": {
- Description: "List of related resources that should be included in the webhook body.",
+ Description: "List of related commercelayer_inventory_stock_location that should be included in the webhook body.",
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeString,
diff --git a/docs/index.md b/docs/index.md
index 3473770..2d8e954 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -9,28 +9,34 @@ The commercelayer provider provides resources to interact with the commercelayer
# commercelayer provider
## Commercial support
-TODO
+
+Need support implementing this terraform module in your organization? We are able to offer support. Please contact us at
+
## Installation
+
Terraform automatically downloads providers from the terraform registry. Add the following to your terraform project
```hcl
terraform {
- required_providers {
- commercelayer = {
- version = ">= 0.0.1"
- source = "incentro-dc/commercelayer"
- }
+ required_providers {
+ commercelayer = {
+ version = ">= 0.0.1"
+ source = "incentro-dc/commercelayer"
}
+ }
}
```
-Packages of the releases are available at [the GitHub Repo](https://github.com/incentro-dc/terraform-provider-commercelayer/releases).
+Packages of the releases are available
+at [the GitHub Repo](https://github.com/incentro-dc/terraform-provider-commercelayer/releases).
See the [terraform documentation](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins)
for more information about installing third-party providers.
## Using the provider
+
The provider attempts to read the required values from environment variables:
+
- `COMMERCELAYER_CLIENT_ID`
- `COMMERCELAYER_CLIENT_SECRET`
- `COMMERCELAYER_API_ENDPOINT`
@@ -40,14 +46,15 @@ Alternatively, you can set it up directly in the terraform file:
```hcl
provider "commercelayer" {
- client_id = ""
- client_secret = ""
- api_endpoint = ""
- auth_endpoint = ""
+ client_id = ""
+ client_secret = ""
+ api_endpoint = ""
+ auth_endpoint = ""
}
```
+
## Schema
### Required
diff --git a/docs/resources/address.md b/docs/resources/address.md
index 72cd9d5..5ab8144 100644
--- a/docs/resources/address.md
+++ b/docs/resources/address.md
@@ -10,7 +10,22 @@ description: |-
Addresses can be associated with orders as their shipping or billing addresses. Add a Google or Bing geocoder to a market if you want its addresses to be automatically geocoded. Customers can save their most-used addresses in their address books (as customer addresses).
-
+## Example Usage
+
+```terraform
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+```
## Schema
diff --git a/docs/resources/customer_group.md b/docs/resources/customer_group.md
index eba3ad4..8394e1a 100644
--- a/docs/resources/customer_group.md
+++ b/docs/resources/customer_group.md
@@ -16,7 +16,15 @@ A customer group is a resource that can be used to organize customers into group
only by the customers belonging to the group. You can use customer groups to manage B2B customers,
B2C loyalty programs, private sales, and more.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_customer_group" "incentro_customer_group" {
+ attributes {
+ name = "Incentro Customer Group"
+ }
+}
+```
## Schema
diff --git a/docs/resources/external_gateway.md b/docs/resources/external_gateway.md
index 5ca9402..84f51d4 100644
--- a/docs/resources/external_gateway.md
+++ b/docs/resources/external_gateway.md
@@ -18,7 +18,20 @@ Price lists are collections of SKU prices,
a stock item in one of the market stock locations will be returned.
A user can create price lists to manage international business or B2B/B2C models.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_external_gateway" "incentro_external_gateway" {
+ attributes {
+ name = "Incentro External Gateway"
+ authorize_url = "https://example.com"
+ capture_url = "https://foo.com"
+ void_url = "https://foo.com"
+ refund_url = "https://example.com"
+ token_url = "https://example.com"
+ }
+}
+```
## Schema
diff --git a/docs/resources/external_tax_calculator.md b/docs/resources/external_tax_calculator.md
index eb3fd87..8c5a563 100644
--- a/docs/resources/external_tax_calculator.md
+++ b/docs/resources/external_tax_calculator.md
@@ -10,7 +10,16 @@ description: |-
Create an external tax calculator to delegate tax calculation logic to the specified external service. Use the order payload to compute your own logic and return the tax rate to be applied to the order.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_external_tax_calculator" "incentro_external_tax_calculator" {
+ attributes {
+ name = "Incentro External Tax Calculator"
+ tax_calculator_url = "https://example.com"
+ }
+}
+```
## Schema
diff --git a/docs/resources/inventory_model.md b/docs/resources/inventory_model.md
index d006f68..f0222b1 100644
--- a/docs/resources/inventory_model.md
+++ b/docs/resources/inventory_model.md
@@ -10,7 +10,17 @@ description: |-
An inventory model defines a list of stock locations ordered by priority. The priority and cutoff determine how the availability of SKU's gets calculated within a market.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_inventory_model" "incentro_inventory_model" {
+ attributes {
+ name = "Incentro Inventory Model"
+ stock_locations_cutoff = 2
+ strategy = "split_shipments"
+ }
+}
+```
## Schema
diff --git a/docs/resources/inventory_return_location.md b/docs/resources/inventory_return_location.md
index 4ea57f8..a083488 100644
--- a/docs/resources/inventory_return_location.md
+++ b/docs/resources/inventory_return_location.md
@@ -10,7 +10,53 @@ description: |-
Inventory return locations build a hierarchy of stock locations within an inventory model, determining the available options for the returns. In the case a SKU is available in more stock locations, it gets returned to those with the highest priority.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_inventory_model" "incentro_inventory_model" {
+ attributes {
+ name = "Incentro Inventory Model"
+ stock_locations_cutoff = 2
+ strategy = "split_shipments"
+ }
+}
+
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+resource "commercelayer_stock_location" "incentro_stock_location" {
+ attributes {
+ name = "Incentro Warehouse Location"
+ label_format = "PNG"
+ suppress_etd = true
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+
+resource "commercelayer_inventory_return_location" "incentro_return_location" {
+ attributes {
+ priority = 1
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ stock_location_id = commercelayer_stock_location.incentro_stock_location.id
+ }
+}
+```
## Schema
diff --git a/docs/resources/inventory_stock_location.md b/docs/resources/inventory_stock_location.md
index b9c6597..831c713 100644
--- a/docs/resources/inventory_stock_location.md
+++ b/docs/resources/inventory_stock_location.md
@@ -10,7 +10,66 @@ description: |-
Inventory stock locations build a hierarchy of stock locations within an inventory model, determining the availability of SKU's that are being purchased. In the case a SKU is available in more stock locations, it gets shipped from those with the highest priority.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_inventory_model" "incentro_inventory_model" {
+ attributes {
+ name = "Incentro Inventory Model"
+ stock_locations_cutoff = 2
+ strategy = "split_shipments"
+ }
+}
+
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+resource "commercelayer_stock_location" "incentro_stock_location" {
+ attributes {
+ name = "Incentro Warehouse Location"
+ label_format = "PNG"
+ suppress_etd = true
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+
+
+resource "commercelayer_inventory_stock_location" "incentro_warehouse_location" {
+ attributes {
+ priority = 1
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ stock_location_id = commercelayer_stock_location.incentro_stock_location.id
+ }
+}
+
+resource "commercelayer_inventory_stock_location" "incentro_backorder_location" {
+ attributes {
+ priority = 2
+ on_hold = true
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ stock_location_id = commercelayer_stock_location.incentro_stock_location.id
+ }
+}
+```
## Schema
diff --git a/docs/resources/market.md b/docs/resources/market.md
index d876b93..571a79e 100644
--- a/docs/resources/market.md
+++ b/docs/resources/market.md
@@ -10,7 +10,61 @@ description: |-
A market is made of a merchant, an inventory model, and a price list (plus an optional customer group, geocoder, and tax calculator)
-
+## Example Usage
+
+```terraform
+resource "commercelayer_inventory_model" "incentro_inventory_model" {
+ attributes {
+ name = "Incentro Inventory Model"
+ stock_locations_cutoff = 2
+ strategy = "split_shipments"
+ }
+}
+
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+
+resource "commercelayer_merchant" "incentro_merchant" {
+ attributes {
+ name = "Incentro Merchant"
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+
+resource "commercelayer_price_list" "incentro_price_list" {
+ attributes {
+ name = "Incentro Price List"
+ currency_code = "EUR"
+ }
+}
+
+resource "commercelayer_market" "incentro_market" {
+ attributes {
+ name = "Incentro Market"
+ facebook_pixel_id = "pixel"
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ merchant_id = commercelayer_merchant.incentro_merchant.id
+ price_list_id = commercelayer_price_list.incentro_price_list.id
+ }
+}
+```
## Schema
diff --git a/docs/resources/merchant.md b/docs/resources/merchant.md
index 0c60e53..3b70338 100644
--- a/docs/resources/merchant.md
+++ b/docs/resources/merchant.md
@@ -10,7 +10,33 @@ description: |-
A merchant is the fiscal representative that is selling in a specific market. Tax calculators use the merchant's address (and the shipping address) to determine the tax rate for an order.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+
+resource "commercelayer_merchant" "incentro_merchant" {
+ attributes {
+ name = "Incentro Merchant"
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+```
## Schema
diff --git a/docs/resources/price_list.md b/docs/resources/price_list.md
index dcf9844..cb5aab7 100644
--- a/docs/resources/price_list.md
+++ b/docs/resources/price_list.md
@@ -18,7 +18,16 @@ Price lists are collections of SKU prices,
a stock item in one of the market stock locations will be returned.
A user can create price lists to manage international business or B2B/B2C models.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_price_list" "incentro_price_list" {
+ attributes {
+ name = "Incentro Price List"
+ currency_code = "EUR"
+ }
+}
+```
## Schema
diff --git a/docs/resources/shipping_category.md b/docs/resources/shipping_category.md
index 9b04c77..db1676e 100644
--- a/docs/resources/shipping_category.md
+++ b/docs/resources/shipping_category.md
@@ -10,7 +10,15 @@ description: |-
Shipping categories determine which shipping methods are available for the associated SKU's. Unless the selected inventory model strategy is no_split, if an order contains line items belonging to more than one shipping category it is split into more shipments.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_shipping_category" "incentro_shipping_category" {
+ attributes {
+ name = "Incentro Shipping Category"
+ }
+}
+```
## Schema
diff --git a/docs/resources/shipping_method.md b/docs/resources/shipping_method.md
index e8141d2..6e16a61 100644
--- a/docs/resources/shipping_method.md
+++ b/docs/resources/shipping_method.md
@@ -10,7 +10,22 @@ description: |-
Shipping methods are used to provide customers with different delivery options.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_shipping_method" "incentro_shipping_method" {
+ attributes {
+ name = "Incentro Shipping Method"
+ scheme = "flat"
+ currency_code = "EUR"
+ price_amount_cents = 1000
+ free_over_amount_cents = 10000
+ min_weight = 0.50
+ max_weight = 10
+ unit_of_weight = "kg"
+ }
+}
+```
## Schema
diff --git a/docs/resources/shipping_zone.md b/docs/resources/shipping_zone.md
index 75cb5c1..0663219 100644
--- a/docs/resources/shipping_zone.md
+++ b/docs/resources/shipping_zone.md
@@ -10,7 +10,21 @@ description: |-
Shipping zones determine the available shipping methods for a given shipping address. The match is evaluated against a set of regular expressions on the address country, state or zip code.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_shipping_zone" "incentro_shipping_zone" {
+ attributes {
+ name = "Incentro Shipping Zone"
+ country_code_regex = ".*"
+ not_country_code_regex = "[^i*&2@]"
+ state_code_regex = "^dog"
+ not_state_code_regex = "//[^\r\n]*[\r\n]"
+ zip_code_regex = "[a-zA-Z]{2,4}"
+ not_zip_code_regex = ".+"
+ }
+}
+```
## Schema
diff --git a/docs/resources/stock_location.md b/docs/resources/stock_location.md
index 08a0bde..21b62cc 100644
--- a/docs/resources/stock_location.md
+++ b/docs/resources/stock_location.md
@@ -10,7 +10,35 @@ description: |-
Shipping zones determine the available shipping methods for a given shipping address. The match is evaluated against a set of regular expressions on the address country, state or zip code.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+
+resource "commercelayer_stock_location" "incentro_warehouse_location" {
+ attributes {
+ name = "Incentro Warehouse Location"
+ label_format = "PNG"
+ suppress_etd = true
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+```
## Schema
diff --git a/docs/resources/webhook.md b/docs/resources/webhook.md
index d19663b..032026d 100644
--- a/docs/resources/webhook.md
+++ b/docs/resources/webhook.md
@@ -10,7 +10,21 @@ description: |-
A webhook object is returned as part of the response body of each successful list, retrieve, create or update API call to the /api/webhooks endpoint.
-
+## Example Usage
+
+```terraform
+resource "commercelayer_webhook" "incentro_webhook" {
+ attributes {
+ name = "Incentro Webhook"
+ topic = "orders.create"
+ callback_url = "http://example.url"
+ include_resources = [
+ "customer",
+ "line_items"
+ ]
+ }
+}
+```
## Schema
@@ -35,7 +49,7 @@ Required:
Optional:
-- `include_resources` (List of String) List of related resources that should be included in the webhook body.
+- `include_resources` (List of String) List of related commercelayer_inventory_stock_location that should be included in the webhook body.
- `metadata` (Map of String) Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format
- `name` (String) Unique name for the webhook.
- `reference` (String) A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
diff --git a/examples/full/inventory_return_locations.tf b/examples/full/inventory_return_locations.tf
deleted file mode 100644
index 9b18dd1..0000000
--- a/examples/full/inventory_return_locations.tf
+++ /dev/null
@@ -1,10 +0,0 @@
-resource "commercelayer_inventory_return_location" "incentro_return_location" {
- attributes {
- priority = 1
- }
-
- relationships {
- inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
- stock_location_id = commercelayer_stock_location.incentro_warehouse_location.id
- }
-}
\ No newline at end of file
diff --git a/examples/full/inventory_stock_locations.tf b/examples/full/inventory_stock_locations.tf
deleted file mode 100644
index 18292de..0000000
--- a/examples/full/inventory_stock_locations.tf
+++ /dev/null
@@ -1,22 +0,0 @@
-resource "commercelayer_inventory_stock_location" "incentro_warehouse_location" {
- attributes {
- priority = 2
- }
-
- relationships {
- inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
- stock_location_id = commercelayer_stock_location.incentro_warehouse_location.id
- }
-}
-
-resource "commercelayer_inventory_stock_location" "incentro_backorder_location" {
- attributes {
- priority = 1
- on_hold = true
- }
-
- relationships {
- inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
- stock_location_id = commercelayer_stock_location.incentro_backorder_location.id
- }
-}
\ No newline at end of file
diff --git a/examples/full/market.tf b/examples/full/market.tf
deleted file mode 100644
index 2832a21..0000000
--- a/examples/full/market.tf
+++ /dev/null
@@ -1,17 +0,0 @@
-resource "commercelayer_market" "incentro_market" {
- attributes {
- name = "Incentro Market"
- //TODO: check why these are considered invalid
- # checkout_url = "http://example.url"
- # external_prices_url = "http://example.url"
- facebook_pixel_id = "pixel"
- }
-
- relationships {
- inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
- merchant_id = commercelayer_merchant.incentro_merchant.id
- price_list_id = commercelayer_price_list.incentro_price_list.id
- customer_group_id = commercelayer_customer_group.incentro_customer_group.id
- tax_calculator_id = commercelayer_external_tax_calculator.incentro_external_tax_calculator.id
- }
-}
\ No newline at end of file
diff --git a/examples/full/merchants.tf b/examples/full/merchants.tf
deleted file mode 100644
index 27f5e53..0000000
--- a/examples/full/merchants.tf
+++ /dev/null
@@ -1,12 +0,0 @@
-resource "commercelayer_merchant" "incentro_merchant" {
- attributes {
- name = "Incentro Merchant"
- metadata = {
- foo : "bar"
- }
- }
-
- relationships {
- address_id = commercelayer_address.incentro_address.id
- }
-}
\ No newline at end of file
diff --git a/examples/full/shipping_methods.tf b/examples/full/shipping_methods.tf
deleted file mode 100644
index 99815ea..0000000
--- a/examples/full/shipping_methods.tf
+++ /dev/null
@@ -1,22 +0,0 @@
-resource "commercelayer_shipping_method" "incentro_shipping_method" {
- attributes {
- name = "Incentro Shipping Method"
- scheme = "flat"
- currency_code = "EUR"
- price_amount_cents = 1000
- free_over_amount_cents = 10000
- min_weight = 0.50
- max_weight = 10
- unit_of_weight = "kg"
- metadata = {
- foo : "bar"
- }
- }
-
- relationships {
- market_id = commercelayer_market.incentro_market.id
- shipping_zone_id = commercelayer_shipping_zone.incentro_shipping_zone.id
- shipping_category_id = commercelayer_shipping_category.incentro_shipping_category.id
- stock_location_id = commercelayer_stock_location.incentro_warehouse_location.id
- }
-}
\ No newline at end of file
diff --git a/examples/full/stock_locations.tf b/examples/full/stock_locations.tf
deleted file mode 100644
index e692c32..0000000
--- a/examples/full/stock_locations.tf
+++ /dev/null
@@ -1,29 +0,0 @@
-resource "commercelayer_stock_location" "incentro_warehouse_location" {
- attributes {
- name = "Incentro Warehouse Location"
- label_format = "PNG"
- suppress_etd = true
- metadata = {
- foo : "bar"
- }
- }
-
- relationships {
- address_id = commercelayer_address.incentro_address.id
- }
-}
-
-resource "commercelayer_stock_location" "incentro_backorder_location" {
- attributes {
- name = "Incentro Backorder Location"
- label_format = "PNG"
- suppress_etd = true
- metadata = {
- foo : "bar"
- }
- }
-
- relationships {
- address_id = commercelayer_address.incentro_address.id
- }
-}
\ No newline at end of file
diff --git a/examples/full/variables.tf b/examples/full/variables.tf
deleted file mode 100644
index 5a3cec4..0000000
--- a/examples/full/variables.tf
+++ /dev/null
@@ -1,15 +0,0 @@
-variable "client_id" {
- type = string
-}
-
-variable "client_secret" {
- type = string
-}
-
-variable "api_endpoint" {
- type = string
-}
-
-variable "auth_endpoint" {
- type = string
-}
\ No newline at end of file
diff --git a/examples/full/webhooks.tf b/examples/full/webhooks.tf
deleted file mode 100644
index 35b2293..0000000
--- a/examples/full/webhooks.tf
+++ /dev/null
@@ -1,14 +0,0 @@
-resource "commercelayer_webhook" "incentro_webhook" {
- attributes {
- name = "Incentro Webhook"
- topic = "orders.create"
- callback_url = "http://example.url"
- include_resources = [
- "customer",
- "line_items"
- ]
- metadata = {
- foo : "bar"
- }
- }
-}
diff --git a/examples/full/main.tf b/examples/provider/provider.tf
similarity index 54%
rename from examples/full/main.tf
rename to examples/provider/provider.tf
index f6ca341..de0e583 100644
--- a/examples/full/main.tf
+++ b/examples/provider/provider.tf
@@ -8,8 +8,8 @@ terraform {
}
provider "commercelayer" {
- client_id = var.client_id
- client_secret = var.client_secret
- api_endpoint = var.api_endpoint
- auth_endpoint = var.auth_endpoint
+ client_id = ""
+ client_secret = ""
+ api_endpoint = ""
+ auth_endpoint = ""
}
\ No newline at end of file
diff --git a/examples/full/addresses.tf b/examples/resources/commercelayer_address/resource.tf
similarity index 88%
rename from examples/full/addresses.tf
rename to examples/resources/commercelayer_address/resource.tf
index b8d1725..0249973 100644
--- a/examples/full/addresses.tf
+++ b/examples/resources/commercelayer_address/resource.tf
@@ -8,8 +8,5 @@ resource "commercelayer_address" "incentro_address" {
city = "Rotterdam"
phone = "+31(0)10 20 20 544"
state_code = "ZH"
- metadata = {
- foo : "bar"
- }
}
}
diff --git a/examples/full/customer_groups.tf b/examples/resources/commercelayer_customer_group/resource.tf
similarity index 75%
rename from examples/full/customer_groups.tf
rename to examples/resources/commercelayer_customer_group/resource.tf
index a803e4e..1568fa3 100644
--- a/examples/full/customer_groups.tf
+++ b/examples/resources/commercelayer_customer_group/resource.tf
@@ -1,8 +1,5 @@
resource "commercelayer_customer_group" "incentro_customer_group" {
attributes {
name = "Incentro Customer Group"
- metadata = {
- foo : "bar"
- }
}
}
\ No newline at end of file
diff --git a/examples/full/external_gateways.tf b/examples/resources/commercelayer_external_gateway/resource.tf
similarity index 89%
rename from examples/full/external_gateways.tf
rename to examples/resources/commercelayer_external_gateway/resource.tf
index 7f7c40c..d32bc7e 100644
--- a/examples/full/external_gateways.tf
+++ b/examples/resources/commercelayer_external_gateway/resource.tf
@@ -6,8 +6,5 @@ resource "commercelayer_external_gateway" "incentro_external_gateway" {
void_url = "https://foo.com"
refund_url = "https://example.com"
token_url = "https://example.com"
- metadata = {
- foo : "bar"
- }
}
}
\ No newline at end of file
diff --git a/examples/full/external_tax_calculators.tf b/examples/resources/commercelayer_external_tax_calculator/resource.tf
similarity index 83%
rename from examples/full/external_tax_calculators.tf
rename to examples/resources/commercelayer_external_tax_calculator/resource.tf
index 40ddc1e..972a0d8 100644
--- a/examples/full/external_tax_calculators.tf
+++ b/examples/resources/commercelayer_external_tax_calculator/resource.tf
@@ -2,8 +2,5 @@ resource "commercelayer_external_tax_calculator" "incentro_external_tax_calculat
attributes {
name = "Incentro External Tax Calculator"
tax_calculator_url = "https://example.com"
- metadata = {
- foo : "bar"
- }
}
}
\ No newline at end of file
diff --git a/examples/full/inventory_models.tf b/examples/resources/commercelayer_inventory_model/resource.tf
similarity index 100%
rename from examples/full/inventory_models.tf
rename to examples/resources/commercelayer_inventory_model/resource.tf
diff --git a/examples/resources/commercelayer_inventory_return_location/resource.tf b/examples/resources/commercelayer_inventory_return_location/resource.tf
new file mode 100644
index 0000000..0a0e874
--- /dev/null
+++ b/examples/resources/commercelayer_inventory_return_location/resource.tf
@@ -0,0 +1,43 @@
+resource "commercelayer_inventory_model" "incentro_inventory_model" {
+ attributes {
+ name = "Incentro Inventory Model"
+ stock_locations_cutoff = 2
+ strategy = "split_shipments"
+ }
+}
+
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+resource "commercelayer_stock_location" "incentro_stock_location" {
+ attributes {
+ name = "Incentro Warehouse Location"
+ label_format = "PNG"
+ suppress_etd = true
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+
+resource "commercelayer_inventory_return_location" "incentro_return_location" {
+ attributes {
+ priority = 1
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ stock_location_id = commercelayer_stock_location.incentro_stock_location.id
+ }
+}
\ No newline at end of file
diff --git a/examples/resources/commercelayer_inventory_stock_location/resource.tf b/examples/resources/commercelayer_inventory_stock_location/resource.tf
new file mode 100644
index 0000000..4fcbad7
--- /dev/null
+++ b/examples/resources/commercelayer_inventory_stock_location/resource.tf
@@ -0,0 +1,56 @@
+resource "commercelayer_inventory_model" "incentro_inventory_model" {
+ attributes {
+ name = "Incentro Inventory Model"
+ stock_locations_cutoff = 2
+ strategy = "split_shipments"
+ }
+}
+
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+resource "commercelayer_stock_location" "incentro_stock_location" {
+ attributes {
+ name = "Incentro Warehouse Location"
+ label_format = "PNG"
+ suppress_etd = true
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+
+
+resource "commercelayer_inventory_stock_location" "incentro_warehouse_location" {
+ attributes {
+ priority = 1
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ stock_location_id = commercelayer_stock_location.incentro_stock_location.id
+ }
+}
+
+resource "commercelayer_inventory_stock_location" "incentro_backorder_location" {
+ attributes {
+ priority = 2
+ on_hold = true
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ stock_location_id = commercelayer_stock_location.incentro_stock_location.id
+ }
+}
\ No newline at end of file
diff --git a/examples/resources/commercelayer_market/resource.tf b/examples/resources/commercelayer_market/resource.tf
new file mode 100644
index 0000000..3d45da9
--- /dev/null
+++ b/examples/resources/commercelayer_market/resource.tf
@@ -0,0 +1,51 @@
+resource "commercelayer_inventory_model" "incentro_inventory_model" {
+ attributes {
+ name = "Incentro Inventory Model"
+ stock_locations_cutoff = 2
+ strategy = "split_shipments"
+ }
+}
+
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+
+resource "commercelayer_merchant" "incentro_merchant" {
+ attributes {
+ name = "Incentro Merchant"
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
+
+resource "commercelayer_price_list" "incentro_price_list" {
+ attributes {
+ name = "Incentro Price List"
+ currency_code = "EUR"
+ }
+}
+
+resource "commercelayer_market" "incentro_market" {
+ attributes {
+ name = "Incentro Market"
+ facebook_pixel_id = "pixel"
+ }
+
+ relationships {
+ inventory_model_id = commercelayer_inventory_model.incentro_inventory_model.id
+ merchant_id = commercelayer_merchant.incentro_merchant.id
+ price_list_id = commercelayer_price_list.incentro_price_list.id
+ }
+}
\ No newline at end of file
diff --git a/examples/resources/commercelayer_merchant/resource.tf b/examples/resources/commercelayer_merchant/resource.tf
new file mode 100644
index 0000000..4c2521a
--- /dev/null
+++ b/examples/resources/commercelayer_merchant/resource.tf
@@ -0,0 +1,23 @@
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+
+resource "commercelayer_merchant" "incentro_merchant" {
+ attributes {
+ name = "Incentro Merchant"
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
\ No newline at end of file
diff --git a/examples/full/price_lists.tf b/examples/resources/commercelayer_price_list/resource.tf
similarity index 78%
rename from examples/full/price_lists.tf
rename to examples/resources/commercelayer_price_list/resource.tf
index ee24915..55fd5e2 100644
--- a/examples/full/price_lists.tf
+++ b/examples/resources/commercelayer_price_list/resource.tf
@@ -2,8 +2,5 @@ resource "commercelayer_price_list" "incentro_price_list" {
attributes {
name = "Incentro Price List"
currency_code = "EUR"
- metadata = {
- foo : "bar"
- }
}
}
\ No newline at end of file
diff --git a/examples/full/shipping_categories.tf b/examples/resources/commercelayer_shipping_category/resource.tf
similarity index 76%
rename from examples/full/shipping_categories.tf
rename to examples/resources/commercelayer_shipping_category/resource.tf
index b92f813..a27f6d0 100644
--- a/examples/full/shipping_categories.tf
+++ b/examples/resources/commercelayer_shipping_category/resource.tf
@@ -1,8 +1,5 @@
resource "commercelayer_shipping_category" "incentro_shipping_category" {
attributes {
name = "Incentro Shipping Category"
- metadata = {
- foo : "bar"
- }
}
}
\ No newline at end of file
diff --git a/examples/resources/commercelayer_shipping_method/resource.tf b/examples/resources/commercelayer_shipping_method/resource.tf
new file mode 100644
index 0000000..9ad6c6a
--- /dev/null
+++ b/examples/resources/commercelayer_shipping_method/resource.tf
@@ -0,0 +1,12 @@
+resource "commercelayer_shipping_method" "incentro_shipping_method" {
+ attributes {
+ name = "Incentro Shipping Method"
+ scheme = "flat"
+ currency_code = "EUR"
+ price_amount_cents = 1000
+ free_over_amount_cents = 10000
+ min_weight = 0.50
+ max_weight = 10
+ unit_of_weight = "kg"
+ }
+}
\ No newline at end of file
diff --git a/examples/full/shipping_zones.tf b/examples/resources/commercelayer_shipping_zone/resource.tf
similarity index 90%
rename from examples/full/shipping_zones.tf
rename to examples/resources/commercelayer_shipping_zone/resource.tf
index 748a4c5..2abc4e5 100644
--- a/examples/full/shipping_zones.tf
+++ b/examples/resources/commercelayer_shipping_zone/resource.tf
@@ -7,8 +7,5 @@ resource "commercelayer_shipping_zone" "incentro_shipping_zone" {
not_state_code_regex = "//[^\r\n]*[\r\n]"
zip_code_regex = "[a-zA-Z]{2,4}"
not_zip_code_regex = ".+"
- metadata = {
- foo : "bar"
- }
}
}
\ No newline at end of file
diff --git a/examples/resources/commercelayer_stock_location/resource.tf b/examples/resources/commercelayer_stock_location/resource.tf
new file mode 100644
index 0000000..ddbd12c
--- /dev/null
+++ b/examples/resources/commercelayer_stock_location/resource.tf
@@ -0,0 +1,25 @@
+resource "commercelayer_address" "incentro_address" {
+ attributes {
+ business = true
+ company = "Incentro"
+ line_1 = "Van Nelleweg 1"
+ zip_code = "3044 BC"
+ country_code = "NL"
+ city = "Rotterdam"
+ phone = "+31(0)10 20 20 544"
+ state_code = "ZH"
+ }
+}
+
+
+resource "commercelayer_stock_location" "incentro_warehouse_location" {
+ attributes {
+ name = "Incentro Warehouse Location"
+ label_format = "PNG"
+ suppress_etd = true
+ }
+
+ relationships {
+ address_id = commercelayer_address.incentro_address.id
+ }
+}
\ No newline at end of file
diff --git a/examples/resources/commercelayer_webhook/resource.tf b/examples/resources/commercelayer_webhook/resource.tf
new file mode 100644
index 0000000..170857f
--- /dev/null
+++ b/examples/resources/commercelayer_webhook/resource.tf
@@ -0,0 +1,11 @@
+resource "commercelayer_webhook" "incentro_webhook" {
+ attributes {
+ name = "Incentro Webhook"
+ topic = "orders.create"
+ callback_url = "http://example.url"
+ include_resources = [
+ "customer",
+ "line_items"
+ ]
+ }
+}