From 8260fd2bebaae42d2a6f72d2585251f39324e32a Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Thu, 17 Sep 2020 16:27:48 -0400 Subject: [PATCH] Update readme and Makefile (#42) * Update readme and Makefile * Fix missed shell command * fix: makefile nuances for darwin system Co-authored-by: Jeff Malnick --- Makefile | 12 +++++++++++- README.md | 16 +++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e45414ef..5e36128f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,13 @@ default: update-deps testacc +GOOS=$(shell go env GOOS) +GOARCH=$(shell go env GOARCH) +INSTALL_PATH=~/.local/share/terraform/plugins/localhost/providers/boundary/0.0.1/linux_$(GOARCH) +ifeq ($(GOOS), darwin) + INSTALL_PATH=~/Library/Application\ Support/io.terraform/plugins/localhost/providers/boundary/0.0.1/darwin_$(GOARCH) +endif +ifeq ($(GOOS), "windows") + INSTALL_PATH=%APPDATA%/HashiCorp/Terraform/plugins/localhost/providers/boundary/0.0.1/windows_$(GOARCH) +endif # Run acceptance tests .PHONY: testacc @@ -16,4 +25,5 @@ update-deps: GOPROXY=direct GOSUMDB=off go get -u dev: - go build -o ~/.terraform.d/plugins/terraform-provider-boundary main.go + mkdir -p $(INSTALL_PATH) + go build -o $(INSTALL_PATH)/terraform-provider-boundary main.go diff --git a/README.md b/README.md index 28a25915..51279a20 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,19 @@ Building The Provider 1. Clone the repository 1. Enter the repository directory -1. Build the provider using the Go `install` command: -```sh -$ go install +1. Build the provider using `make dev`. This will place the provider onto your system in a [Terraform 0.13-compliant](https://www.terraform.io/upgrade-guides/0-13.html#in-house-providers) manner. + +You'll need to ensure that your Terraform file contains the information necessary to find the plugin when running `terraform init`. `make dev` will use a version number of 0.0.1, so the following block will work: + +```hcl +terraform { + required_providers { + boundary = { + source = "localhost/providers/boundary" + version = "0.0.1" + } + } +} ``` Adding Dependencies