Skip to content

Commit

Permalink
update to support Terraform 0.7 plugin architecture (#30)
Browse files Browse the repository at this point in the history
* update go to 1.7.3
* set sudo to false
* mkdirs and cp files around
* update README
  • Loading branch information
pdxfixit authored Oct 31, 2016
1 parent be51a9b commit b1ebe9e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
sudo: false
language: go

go:
- 1.6
- 1.7.3

before_install:
- go get github.com/hashicorp/terraform
- go get github.com/mitchellh/gox
- go get github.com/scottdware/go-bigip

install: make get-deps
install:
- make get-deps

script: make bin
script:
- make bin

after_success: make dist
after_success:
- make dist

deploy:
provider: releases
Expand Down
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ OUT_DIR = target
BIN_DIR = $(OUT_DIR)/bin
PKG_DIR = $(OUT_DIR)/pkg

TF_DIR = ../../hashicorp/terraform
BIGIP_BIN_PATH = $(TF_DIR)/builtin/bins/provider-bigip

PKGS = $(foreach arch,$(ARCHS),$(foreach os,$(OS),$(PKG_DIR)/$(PROJ)_$(os)_$(arch)$(PKG_SUFFIX)))
BINS = $(foreach arch,$(ARCHS),$(foreach os,$(OS),$(BIN_DIR)/$(os)_$(arch)/$(PROJ)))

Expand All @@ -21,7 +24,10 @@ bin: test
@gox -help >/dev/null 2>&1 ; if [ $$? -ne 2 ]; then \
go get github.com/mitchellh/gox; \
fi
@gox -output="$(BIN_DIR)/{{.OS}}_{{.Arch}}/{{.Dir}}" -arch="$(ARCHS)" -os="$(OS)"
@cp main.go "$(BIGIP_BIN_PATH)/main.go"
@sed -i'' "s|github.com/DealerDotCom/terraform-provider-bigip|github.com/hashicorp/terraform/builtin/providers|" "$(BIGIP_BIN_PATH)/main.go"
@cp -r bigip "$(TF_DIR)/builtin/providers"
@gox -output="$(BIN_DIR)/{{.OS}}_{{.Arch}}/terraform-{{.Dir}}" -arch="$(ARCHS)" -os="$(OS)" "github.com/hashicorp/terraform/builtin/bins/provider-bigip"

dist:
@mkdir -p $(PKG_DIR) 2>/dev/null
Expand All @@ -34,6 +40,16 @@ dist:

get-deps:
@go get -t -v ./...
@if [ ! -d "$(TF_DIR)" ]; then \
go get github.com/hashicorp/terraform; \
if [ ! -d "$(TF_DIR)" ]; then \
echo "ERROR: terraform could not be found."; \
exit 1; \
fi \
fi
@if [ ! -d "$(BIGIP_BIN_PATH)" ]; then \
mkdir "$(BIGIP_BIN_PATH)"; \
fi

fmt:
@gofmt -l -w . bigip/
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This provider uses the iControlREST API. Make sure that is installed and enabled

- Download the latest [release](https://github.com/DealerDotCom/terraform-provider-bigip/releases) for your platform.
- Rename the executable to `terraform-provider-bigip`
- Copy somewhere on your path or update `.terraformrc` in your home directory like so:
- Copy somewhere on your path, or update `.terraformrc` in your home directory like so:
```
providers {
bigip = "/path/to/terraform-provider-bigip"
Expand Down Expand Up @@ -328,9 +328,14 @@ resource "bigip_ltm_policy" "policy" {
Create the distributable packages like so:

```
make && make dist
make get-deps && make bin && make dist
```

See these pages for more information:

* https://www.terraform.io/docs/internals/internal-plugins.html
* https://github.com/hashicorp/terraform#developing-terraform

# Testing

Running the acceptance test suite requires an F5 to test against. Set `BIGIP_HOST`, `BIGIP_USER`
Expand Down

0 comments on commit b1ebe9e

Please sign in to comment.