This repository contains a Terraform provider for the Elastic Path Commerce Cloud API.
This project was based upon the Terraform Provider Scaffolding Project
- Clone the repository
 - Enter the repository directory
 - Build the provider using the Go 
installcommand: 
$ go installThe following environment variables are defined in the EPCC Terraform Provider.
| Name | Default | Description | 
|---|---|---|
EPCC_API_BASE_URL | 
- | The Base URL of the EPCC API | 
EPCC_BETA_API_FEATURES | 
- | The value of the EP-Beta-Features header being sent to the EPCC API | 
EPCC_CLIENT_ID | 
- | Client ID used for authenticating to the EPCC API | 
EPCC_CLIENT_SECRET | 
- | Client Secret used for authenticating to the EPCC API | 
EPCC_RATE_LIMIT | 
25 | A limit on the number of requests that can be made per second to EPCC | 
EPCC_LOG_DIR | 
(work directory) | The directory of the http log files | 
This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.
To add a new dependency github.com/author/dependency to your Terraform provider:
go get github.com/author/dependency
go mod tidy
Then commit the changes to go.mod and go.sum.
This project follows the terraform provider template: GitHub template repository documentation
| Directory | Description | 
|---|---|
docs/ | 
Folder that contains documentation | 
examples/ | 
Directory for sample resources and data sources | 
component-tests/ | 
Component tests for the service are located in here. | 
external/ | 
Any Go package that can be shared with other projects | 
internal/ | 
Application specific Go packages, e.g., they cannot be shared and are specific to this service | 
You would use the epcc-terraform-provider just as any other terraform provider. See the ./examples directory for sample resources and data sources.
See the [Core Terraform Workflow] (https://www.terraform.io/guides/core-workflow.html) page for more info on using Terraform.
| Command | Description | 
|---|---|
| go install | Compile the provider. This will build the provider and put the provider binary in the $GOPATH/bin directory. | 
| go generate | Generate or update documentation | 
| make testacc | Runs the full suite of Acceptance tests | 
- 
Run
make build - 
Run the following command (assuming you've installed delve)
 
dlv exec --accept-multiclient --continue --headless ./bin/terraform-provider-epcc --listen=:41837 -- -debug- 
Connect with your Debugger
 - 
Find the line
TF_REATTACH_PROVIDERSin the output - 
When running terraform prefix the above to the command, for example:
 
TF_REATTACH_PROVIDERS='...' terraform apply
Please run gofmt prior to committing, the following pre-commit hook (create and mark executable
in .git/hooks/pre-commit) can do this automatically for you
#!/bin/bash
echo "Running commit hook"
echo "Fixing changed files"
git diff --cached --name-only --diff-filter=ACM | grep -E "\.go$" | xargs -n 1 -d "\n" gofmt -s -w
git diff --cached --name-only --diff-filter=ACM | grep -E "\.go$" | xargs git add 
echo "Inspecting all other files"
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
  echo "Code style differences detected:"
  gofmt -s -l .
  exit 1
fi