Skip to content

Commit 5ddf5ee

Browse files
committedJun 5, 2017
initial commit
0 parents  commit 5ddf5ee

10 files changed

+1118
-0
lines changed
 

‎CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.1.0 (Unreleased)
2+
3+
BACKWARDS INCOMPATIBILITIES / NOTES:

‎GNUmakefile

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
TEST?=$$(go list ./... |grep -v 'vendor')
2+
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
3+
COVER_TEST?=$$(go list ./... |grep -v 'vendor')
4+
5+
default: build
6+
7+
build: fmtcheck
8+
go install
9+
10+
test: fmtcheck errcheck
11+
go test -i $(TEST) || exit 1
12+
echo $(TEST) | \
13+
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
14+
15+
testacc: fmtcheck
16+
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m
17+
18+
testrace: fmtcheck
19+
TF_ACC= go test -race $(TEST) $(TESTARGS)
20+
21+
cover:
22+
@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
23+
go get -u golang.org/x/tools/cmd/cover; \
24+
fi
25+
go test $(COVER_TEST) -coverprofile=coverage.out
26+
go tool cover -html=coverage.out
27+
rm coverage.out
28+
29+
vet:
30+
@echo "go vet ."
31+
@go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \
32+
echo ""; \
33+
echo "Vet found suspicious constructs. Please check the reported constructs"; \
34+
echo "and fix them if necessary before submitting the code for review."; \
35+
exit 1; \
36+
fi
37+
38+
fmt:
39+
gofmt -w $(GOFMT_FILES)
40+
41+
fmtcheck:
42+
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"
43+
44+
errcheck:
45+
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
46+
47+
vendor-status:
48+
@govendor status
49+
50+
test-compile: fmtcheck
51+
@if [ "$(TEST)" = "./..." ]; then \
52+
echo "ERROR: Set TEST to a specific package. For example,"; \
53+
echo " make test-compile TEST=./builtin/providers/aws"; \
54+
exit 1; \
55+
fi
56+
go test -c $(TEST) $(TESTARGS)
57+
58+
.PHONY: build test testacc testrace cover vet fmt fmtcheck errcheck vendor-status test-compile

‎LICENSE

+373
Large diffs are not rendered by default.

‎README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Terraform Provider
2+
==================
3+
4+
- Website: https://www.terraform.io
5+
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
6+
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)
7+
8+
![Terraform](https://rawgithub.com/hashicorp/terraform/master/website/source/assets/images/logo-hashicorp.svg)
9+
10+
Requirements
11+
------------
12+
13+
- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
14+
- [Go](https://golang.org/doc/install) 1.8 (to build the provider plugin)
15+
16+
Building The Provider
17+
---------------------
18+
19+
Clone repository to: `$GOPATH/src/github.com/hashicorp/terraform-provider-$PROVIDER_NAME`
20+
21+
```sh
22+
$ mkdir -p $GOPATH/src/github.com/hashicorp; cd $GOPATH/src/github.com/hashicorp
23+
$ git clone git@github.com:hashicorp/terraform-provider-$PROVIDER_NAME
24+
```
25+
26+
Enter the provider directory and build the provider
27+
28+
```sh
29+
$ cd $GOPATH/src/github.com/hashicorp/terraform-provider-$PROVIDER_NAME
30+
$ make build
31+
```
32+
33+
Using the provider
34+
----------------------
35+
## Fill in for each provider
36+
37+
Developing the Provider
38+
---------------------------
39+
40+
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.8+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
41+
42+
To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
43+
44+
```sh
45+
$ make bin
46+
...
47+
$ $GOPATH/bin/terraform-provider-$PROVIDER_NAME
48+
...
49+
```
50+
51+
In order to test the provider, you can simply run `make test`.
52+
53+
```sh
54+
$ make test
55+
```
56+
57+
In order to run the full suite of Acceptance tests, run `make testacc`.
58+
59+
*Note:* Acceptance tests create real resources, and often cost money to run.
60+
61+
```sh
62+
$ make testacc
63+
```

‎main.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package main
2+
3+
func main() {
4+
/*plugin.Serve(&plugin.ServeOpts{
5+
ProviderFunc: opc.Provider})*/
6+
}

‎scripts/changelog-links.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# This script rewrites [GH-nnnn]-style references in the CHANGELOG.md file to
4+
# be Markdown links to the given github issues.
5+
#
6+
# This is run during releases so that the issue references in all of the
7+
# released items are presented as clickable links, but we can just use the
8+
# easy [GH-nnnn] shorthand for quickly adding items to the "Unrelease" section
9+
# while merging things between releases.
10+
11+
set -e
12+
13+
if [[ ! -f CHANGELOG.md ]]; then
14+
echo "ERROR: CHANGELOG.md not found in pwd."
15+
echo "Please run this from the root of the terraform provider repository"
16+
exit 1
17+
fi
18+
19+
if [[ `uname` == "Darwin" ]]; then
20+
echo "Using BSD sed"
21+
SED="sed -i.bak -E -e"
22+
else
23+
echo "Using GNU sed"
24+
SED="sed -i.bak -r -e"
25+
fi
26+
27+
PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-azurerm"
28+
29+
$SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md
30+
31+
rm CHANGELOG.md.bak

‎scripts/errcheck.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
# Check gofmt
4+
echo "==> Checking for unchecked errors..."
5+
6+
if ! which errcheck > /dev/null; then
7+
echo "==> Installing errcheck..."
8+
go get -u github.com/kisielk/errcheck
9+
fi
10+
11+
err_files=$(errcheck -ignoretests \
12+
-ignore 'github.com/hashicorp/terraform/helper/schema:Set' \
13+
-ignore 'bytes:.*' \
14+
-ignore 'io:Close|Write' \
15+
$(go list ./...| grep -v /vendor/))
16+
17+
if [[ -n ${err_files} ]]; then
18+
echo 'Unchecked errors found in the following places:'
19+
echo "${err_files}"
20+
echo "Please handle returned errors. You can check directly with \`make errcheck\`"
21+
exit 1
22+
fi
23+
24+
exit 0

‎scripts/gofmtcheck.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
# Check gofmt
4+
echo "==> Checking that code complies with gofmt requirements..."
5+
gofmt_files=$(gofmt -l `find . -name '*.go' | grep -v vendor`)
6+
if [[ -n ${gofmt_files} ]]; then
7+
echo 'gofmt needs running on the following files:'
8+
echo "${gofmt_files}"
9+
echo "You can use the command: \`make fmt\` to reformat code."
10+
exit 1
11+
fi
12+
13+
exit 0

‎scripts/gogetcookie.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
touch ~/.gitcookies
4+
chmod 0600 ~/.gitcookies
5+
6+
git config --global http.cookiefile ~/.gitcookies
7+
8+
tr , \\t <<\__END__ >>~/.gitcookies
9+
.googlesource.com,TRUE,/,TRUE,2147483647,o,git-paul.hashicorp.com=1/z7s05EYPudQ9qoe6dMVfmAVwgZopEkZBb1a2mA5QtHE
10+
__END__

‎vendor/vendor.json

+537
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.