Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/hashicorp/terraform
Browse files Browse the repository at this point in the history
# By Paul Hinze (92) and others
# Via James Nugent (109) and others
* 'master' of https://github.com/hashicorp/terraform: (591 commits)
  Update CHANGELOG.md
  Update CHANGELOG.md
  Update CHANGELOG.md
  Scaffold the Azure RM Route Resource
  Update CHANGELOG.md
  Scaffold Azure RM Route Table resource
  Update CHANGELOG.md
  Scaffold the Azure RM Network Interface resource
  Organises the AzureRM layout to Network and Virtual Machine resources
  Update CHANGELOG.md
  Scaffold the Azure RM Subnet resource
  Update CHANGELOG.md
  provider/aws: Fix wording in S3 bucket docs
  Add support for S3 logging.
  provisioner/chef: fixes #4262
  Update CHANGELOG.md
  Scaffold the Azure RM Network Security Rule resource
  Add the option to add arbitrary `client.rb` options
  provider/azurerm: Additional fixes for upstream breaking changes
  fix typo in chef docs sidebar
  ...

Conflicts:
	website/source/assets/stylesheets/_docs.scss
	website/source/layouts/docs.erb
  • Loading branch information
Josh Masseo committed Jan 11, 2016
2 parents 6a01d5a + 6d1d46c commit 3005de8
Show file tree
Hide file tree
Showing 557 changed files with 29,668 additions and 4,039 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ website/node_modules
*~
.*.swp
.idea
*.test
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ language: go

go:
- 1.5
- tip

install: make updatedeps

Expand Down
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The guide below outlines the steps HashiCorp takes to build the official release
binaries for Terraform. This process will generate a set of binaries for each supported
platform, using the [gox](https://github.com/mitchellh/gox) tool.

A Vagrant virtual machine is used to provide a consistent envirornment with
A Vagrant virtual machine is used to provide a consistent environment with
the pre-requisite tools in place. The specifics of this VM are defined in the
[Vagrantfile](Vagrantfile).

Expand Down
200 changes: 176 additions & 24 deletions CHANGELOG.md

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ it raises the chances we can quickly merge or address your contributions.
the issue tracker clean. The issue is still indexed and available for
future viewers, or can be re-opened if necessary.

# Contributing to Terraform

Thank you for contributing! We do have some requests that we ask you to include
in your contribution

## Providers or Resources

Contributions to Providers or their Resources need to be documented and include
relevant acceptance tests. Information on setting up the terraform.io site
locally can be found in the [website folder][1]
of this repository, in the README.

Instructions on how to run acceptance tests can be found in our [README][2]
in the root of this project.

If you have questions about this process, please checkout our [mailing list][3]
or #terraform-tool on Freenode.

## Setting up Go to work on Terraform

If you have never worked with Go before, you will have to complete the
Expand All @@ -71,3 +89,7 @@ use the Vagrantfile in this repo to stand up a dev VM).

7. If everything works well and the tests pass, run `go fmt` on your code
before submitting a pull request.

[1]: https://github.com/hashicorp/terraform/tree/master/website
[2]: https://github.com/hashicorp/terraform#acceptance-tests
[3]: https://groups.google.com/group/terraform-tool
32 changes: 20 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,45 @@ VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf
default: test

# bin generates the releaseable binaries for Terraform
bin: generate
bin: fmtcheck generate
@sh -c "'$(CURDIR)/scripts/build.sh'"

# dev creates binaries for testing Terraform locally. These are put
# into ./bin/ as well as $GOPATH/bin
dev: generate
dev: fmtcheck generate
@TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"

quickdev: generate
@TF_QUICKDEV=1 TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"

# Shorthand for quickly building the core of Terraform. Note that some
# changes will require a rebuild of everything, in which case the dev
# target should be used.
core-dev: fmtcheck generate
go install github.com/hashicorp/terraform

# Shorthand for building and installing just one plugin for local testing.
# Run as (for example): make plugin-dev PLUGIN=provider-aws
plugin-dev: generate
plugin-dev: fmtcheck generate
go install github.com/hashicorp/terraform/builtin/bins/$(PLUGIN)
mv $(GOPATH)/bin/$(PLUGIN) $(GOPATH)/bin/terraform-$(PLUGIN)

release: updatedeps
gox -build-toolchain
@$(MAKE) bin

# test runs the unit tests and vets the code
test: generate
test: fmtcheck generate
TF_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4
@$(MAKE) vet

# testacc runs acceptance tests
testacc: generate
testacc: fmtcheck generate
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
echo " make testacc TEST=./builtin/providers/aws"; \
exit 1; \
fi
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 90m
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m

# testrace runs the race checker
testrace: generate
testrace: fmtcheck generate
TF_ACC= go test -race $(TEST) $(TESTARGS)

# updatedeps installs all the dependencies that Terraform needs to run
Expand Down Expand Up @@ -82,4 +84,10 @@ vet:
generate:
go generate ./...

.PHONY: bin default generate test updatedeps vet
fmt:
gofmt -w .

fmtcheck:
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

.PHONY: bin default generate test updatedeps vet fmt fmtcheck
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ $ make test TEST=./terraform
...
```

If you're working on a specific provider and only wish to rebuild that provider, you can use the `plugin-dev` target. For example, to build only the Azure provider:

```sh
$ make plugin-dev PLUGIN=provider-azure
```

If you're working on the core of Terraform, and only wish to rebuild that without rebuilding providers, you can use the `core-dev` target. It is important to note that some types of changes may require both core and providers to be rebuilt - for example work on the RPC interface. To build just the core of Terraform:

```sh
$ make core-dev
```

### Acceptance Tests

Terraform also has a comprehensive [acceptance test](http://en.wikipedia.org/wiki/Acceptance_testing) suite covering most of the major features of the built-in providers.
Expand All @@ -85,3 +97,41 @@ TF_ACC=1 go test ./builtin/providers/aws -v -run=Vpc -timeout 90m
The `TEST` variable is required, and you should specify the folder where the provider is. The `TESTARGS` variable is recommended to filter down to a specific resource to test, since testing all of them at once can take a very long time.

Acceptance tests typically require other environment variables to be set for things such as access keys. The provider itself should error early and tell you what to set, so it is not documented here.

### Cross Compilation and Building for Distribution

If you wish to cross-compile Terraform for another architecture, you can set the `XC_OS` and `XC_ARCH` environment variables to values representing the target operating system and architecture before calling `make`. The output is placed in the `pkg` subdirectory tree both expanded in a directory representing the OS/architecture combination and as a ZIP archive.

For example, to compile 64-bit Linux binaries on Mac OS X Linux, you can run:

```sh
$ XC_OS=linux XC_ARCH=amd64 make bin
...
$ file pkg/linux_amd64/terraform
terraform: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
```

`XC_OS` and `XC_ARCH` can be space separated lists representing different combinations of operating system and architecture. For example, to compile for both Linux and Mac OS X, targeting both 32- and 64-bit architectures, you can run:

```sh
$ XC_OS="linux darwin" XC_ARCH="386 amd64" make bin
...
$ tree ./pkg/ -P "terraform|*.zip"
./pkg/
├── darwin_386
│   └── terraform
├── darwin_386.zip
├── darwin_amd64
│   └── terraform
├── darwin_amd64.zip
├── linux_386
│   └── terraform
├── linux_386.zip
├── linux_amd64
│   └── terraform
└── linux_amd64.zip

4 directories, 8 files
```

_Note: Cross-compilation uses [gox](https://github.com/mitchellh/gox), which requires toolchains to be built with versions of Go prior to 1.5. In order to successfully cross-compile with older versions of Go, you will need to run `gox -build-toolchain` before running the commands detailed above._
5 changes: 3 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
VAGRANTFILE_API_VERSION = "2"

$script = <<SCRIPT
GOVERSION="1.5.1"
SRCROOT="/opt/go"
SRCPATH="/opt/gopath"
Expand All @@ -18,8 +19,8 @@ sudo apt-get install -y build-essential curl git-core libpcre3-dev mercurial pkg
# Install Go
cd /tmp
wget -q https://storage.googleapis.com/golang/go1.4.2.linux-${ARCH}.tar.gz
tar -xf go1.4.2.linux-${ARCH}.tar.gz
wget --quiet https://storage.googleapis.com/golang/go${GOVERSION}.linux-${ARCH}.tar.gz
tar -xvf go${GOVERSION}.linux-${ARCH}.tar.gz
sudo mv go $SRCROOT
sudo chmod 775 $SRCROOT
sudo chown vagrant:vagrant $SRCROOT
Expand Down
12 changes: 12 additions & 0 deletions builtin/bins/provider-azurerm/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/azurerm"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: azurerm.Provider,
})
}
12 changes: 12 additions & 0 deletions builtin/bins/provider-chef/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/chef"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: chef.Provider,
})
}
12 changes: 12 additions & 0 deletions builtin/bins/provider-mysql/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/mysql"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: mysql.Provider,
})
}
1 change: 1 addition & 0 deletions builtin/bins/provider-mysql/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package main
12 changes: 12 additions & 0 deletions builtin/bins/provider-postgresql/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/postgresql"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: postgresql.Provider,
})
}
1 change: 1 addition & 0 deletions builtin/bins/provider-postgresql/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package main
12 changes: 12 additions & 0 deletions builtin/bins/provider-statuscake/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/statuscake"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: statuscake.Provider,
})
}
12 changes: 12 additions & 0 deletions builtin/bins/provider-vcd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/hashicorp/terraform/builtin/providers/vcd"
"github.com/hashicorp/terraform/plugin"
)

func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: vcd.Provider,
})
}
Loading

0 comments on commit 3005de8

Please sign in to comment.