Skip to content

edahlseng/terraform-provider-shopify

Repository files navigation

Shopify Terraform Provider

Setup

From within the Shopify Admin Interface:

  • Click on "Apps" from the list on the left hand sidebar (or go to .myshopify.com/admin/apps
  • Click on "Manage private apps" (or go to .myshopify.com/admin/apps/private)
  • Create a new private app
  • Configure the provider as follows:
provider "shopify" {
  access_token = "<app password>"
  domain       = "<yourstore>.myshopify.com"
}

Resources

shopify_webhook

For reference, see Shopify's Webhook Documentation.

Note: Webhooks created via this resource are not visible within the Shopify Admin GUI. To view webhook created this resource, an API request needs to be made with the same app credentials passed into this provider. Example:

curl https://<yourstore>.myshopify.com/admin/webhooks.json -H "X-Shopify-Access-Token: <app password>"

Example Usage:

resource "shopify_webhook" "example" {
  address = "https://mywebhook.example.com"
  topic   = "orders/create"
  format  = "json"
}

Argument Reference:

The following arguments are supported:

  • topic (Required) - The event topic for which webhook messages should be sent. See the Shopify documentation for the full list of available topics.
  • address (Required) - The full URL to send webhooks to
  • format (Required) - The format to send webhook messages in. Can be either json or xml.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • topic - The event topic for which webhook messages are sent
  • address - The full URL to send webhooks to
  • format - The format to send webhook messages in. Will be one of json or xml.

Import

Instances can be imported using the id, e.g.

terraform import shopify_webhook.example 440719081554

Building The Provider

make build # `gnumake build` on macOS