Skip to content

Commit

Permalink
Merge branch 'master' of github.com:terraform-providers/terraform-pro…
Browse files Browse the repository at this point in the history
…vider-vsphere into networkInterfaces
  • Loading branch information
Robbert Müller committed Aug 11, 2017
2 parents fb832ff + 0496b01 commit c46af8d
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 75 deletions.
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dist: trusty
sudo: false
language: go
go:
- 1.8.1

install:
# This script is used by the Travis build to install a cookie for
# go.googlesource.com so rate limits are higher when using `go get` to fetch
# packages that live there.
# See: https://github.com/golang/go/issues/12933
- bash scripts/gogetcookie.sh
- go get github.com/kardianos/govendor

script:
- make test
- make vendor-status
- make vet

branches:
only:
- master
matrix:
fast_finish: true
allow_failures:
- go: tip
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 0.1.0 (Unreleased)
## 0.1.1 (Unreleased)

BACKWARDS INCOMPATIBILITIES / NOTES:
BUG FIXES:
* Updated [govmomi](https://github.com/vmware/govmomi) to v0.15.0 [GH-114]

IMPROVEMENTS:
* r/vsphere_virtual_machine: Add annotation argument [GH-111]

## 0.1.0 (June 20, 2017)

NOTES:

* Same functionality as that of Terraform 0.9.8. Repacked as part of [Provider Splitout](https://www.hashicorp.com/blog/upcoming-provider-changes-in-terraform-0-10/)
21 changes: 6 additions & 15 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-include $(HOME)/.tf-vsphere-devrc.mk

TEST?=$$(go list ./... |grep -v 'vendor')
GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor)
COVER_TEST?=$$(go list ./... |grep -v 'vendor')

default: build

Expand All @@ -15,17 +16,6 @@ test: fmtcheck
testacc: fmtcheck
TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m

testrace: fmtcheck
TF_ACC= go test -race $(TEST) $(TESTARGS)

cover:
@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
go get -u golang.org/x/tools/cmd/cover; \
fi
go test $(COVER_TEST) -coverprofile=coverage.out
go tool cover -html=coverage.out
rm coverage.out

vet:
@echo "go vet ."
@go vet $$(go list ./... | grep -v vendor/) ; if [ $$? -eq 1 ]; then \
Expand All @@ -47,12 +37,13 @@ errcheck:
vendor-status:
@govendor status

test-compile: fmtcheck
test-compile:
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
echo " make test-compile TEST=./builtin/providers/aws"; \
echo " make test-compile TEST=./aws"; \
exit 1; \
fi
go test -c $(TEST) $(TESTARGS)

.PHONY: build test testacc testrace cover vet fmt fmtcheck errcheck vendor-status test-compile
.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile

156 changes: 156 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Terraform vSphere Provider

This is the repository for the Terraform vSphere Provider, which one can use
with Terraform to work with VMware vSphere Products, notably [vCenter Server][1]
and [ESXi][2].

[1]: https://www.vmware.com/products/vcenter-server.html
[2]: https://www.vmware.com/products/esxi-and-esx.html

Coverage is currently only limited to a few resources namely surrounding virtual
machines, but in the coming months we are planning release coverage for most
essential vSphere workflows, including working with storage and networking
components such as datastores, and standard and distributed vSwitches. Watch
this space!

For general information about Terraform, visit the [official website][3] and the
[GitHub project page][4].

[3]: https://terraform.io/
[4]: https://github.com/hashicorp/terraform

# Using the Provider

The current version of this provider requires Terraform v0.10.0 or higher to
run.

Note that you need to run `terraform init` to fetch the provider before
deploying. Read about the provider split and other changes to TF v0.10.0 in the
official release announcement found [here][4].

[4]: https://www.hashicorp.com/blog/hashicorp-terraform-0-10/

## Full Provider Documentation

The provider is documented in full on the Terraform website and can be found
[here][5]. Check the provider documentation for details on entering your
connection information and how to get started with writing configuration for
vSphere resources.

[5]: https://www.terraform.io/docs/providers/vsphere/index.html

### Controlling the provider version

Note that you can also control the provider version. This requires the use of a
`provider` block in your Terraform configuration if you have not added one
already.

The syntax is as follows:

```hcl
provider "vsphere" {
version = "~> 0.1"
...
}
```

Version locking uses a pessimistic operator, so this version lock would mean
anything within the 0.1.x namespace. [Read more][6] on provider version control.

[6]: https://www.terraform.io/docs/configuration/providers.html#provider-versions

# Building The Provider

**NOTE:** Unless you are [developing][7] or require a pre-release bugfix or feature,
you will want to use the officially released version of the provider (see [the
section above][8]).

[7]: #developing-the-provider
[8]: #using-the-provider


## Cloning the Project

First, you will want to clone the repository to
`$GOPATH/src/github.com/terraform-providers/terraform-provider-vsphere`:

```sh
mkdir -p $GOPATH/src/github.com/terraform-providers
cd $GOPATH/src/github.com/terraform-providers
git clone [email protected]:terraform-providers/terraform-provider-vsphere
```

## Running the Build

After the clone has been completed, you can enter the provider directory and
build the provider.

```sh
cd $GOPATH/src/github.com/terraform-providers/terraform-provider-vsphere
make build
```

## Installing the Local Plugin

After the build is complete, copy the `terraform-provider-vsphere` binary into
the same path as your `terraform` binary, and re-run `terraform init`.

After this, your project-local `.terraform/plugins/ARCH/lock.json` (where `ARCH`
matches the architecture of your machine) file should contain a SHA256 sum that
matches the local plugin. Run `shasum -a 256` on the binary to verify the values
match.

# Developing the Provider

If you wish to work on the provider, you'll first need [Go][9] installed on your
machine (version 1.8+ is **required**). You'll also need to correctly setup a
[GOPATH][10], as well as adding `$GOPATH/bin` to your `$PATH`.

[9]: https://golang.org/
[10]: http://golang.org/doc/code.html#GOPATH

See [Building the Provider][11] for details on building the provider.

[11]: #building-the-provider

# Testing the Provider

**NOTE:** Testing the vSphere provider is currently a complex operation as it
requires having a vCenter endpoint to test against, which should be hosting a
standard configuration for a vSphere cluster. Some of the tests will work
against ESXi, but YMMV.

## Configuring Environment Variables

Most of the tests in this provider require a comprehensive list of environment
variables to run. See the individual `*_test.go` files in the
[`vsphere/`](vsphere/) directory for more details. The next section also
describes how you can manage a configuration file of the test environment
variables.

### Using the `.tf-vsphere-devrc.mk` file

The [`tf-vsphere-devrc.mk.example`](tf-vsphere-devrc.mk.example) file contains
an up-to-date list of environment variables required to run the acceptance
tests. Copy this to `$HOME/.tf-vsphere-devrc.mk` and change the permissions to
something more secure (ie: `chmod 600 $HOME/.tf-vsphere-devrc.mk`), and
configure the variables accordingly.

## Running the Acceptance Tests

After this is done, you can run the acceptance tests by running:

```sh
$ make testacc
```

If you want to run against a specific set of tests, run `make testacc` with the
`TESTARGS` parameter containing the run mask as per below:

```sh
make testacc TESTARGS="-run=TestAccVSphereVirtualMachine"
```

This following example would run all of the acceptance tests matching
`TestAccVSphereVirtualMachine`. Change this for the specific tests you want to
run.
2 changes: 1 addition & 1 deletion scripts/changelog-links.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else
SED="sed -i.bak -r -e"
fi

PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-vsphere"
PROVIDER_URL="https:\/\/github.com\/terraform-providers\/terraform-provider-vsphere\/issues"

$SED "s/GH-([0-9]+)/\[#\1\]\($PROVIDER_URL\/\1\)/g" -e 's/\[\[#(.+)([0-9])\)]$/(\[#\1\2))/g' CHANGELOG.md

Expand Down
34 changes: 34 additions & 0 deletions tf-vsphere-devrc.mk.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This file is designed to assist you with configuring your environment for
# testing the vSphere provider, and also serves as a catalog of the environment
# variables that are required to test all of the resources in this provider.
#
# This should be copied to ~/.tf-vsphere-devrc.mk and edited accordingly.
#
# Note that the use of all of this file is not required - environment variables
# can still be completely set from the command line or your existing
# environment. In this case, don't use this file as it may cause conflicts.
#
# The essentials. None of the tests will run if you don't have these.
export VSPHERE_SERVER ?= vcenter.internal
export VSPHERE_USER ?= [email protected]
export VSPHERE_PASSWORD ?= changeme

# Enable this if you want to skip SSL verification
export VSPHERE_ALLOW_UNVERIFIED_SSL ?= false

# The following variables are shared across various tests. To ensure all tests
# succeed, it's probably best to set all of these to valid values.
export VSPHERE_TEMPLATE ?= base-linux # VM template to clone
export VSPHERE_NETWORK_LABEL ?= vm-network # Port group label
export VSPHERE_NETWORK_LABEL_DHCP ?= vm-network # Port group label for DHCP
export VSPHERE_IPV4_ADDRESS ?= 10.0.0.100 # Customization IP address
export VSPHERE_IPV4_PREFIX ?= 24 # Customization netmask
export VSPHERE_IPV4_GATEWAY ?= 10.0.0.1 # Customization gateway
export VSPHERE_DATACENTER ?= vm-dc # VM placement DC
export VSPHERE_CLUSTER ?= vm-clus1 # VM placement cluster
export VSPHERE_RESOURCE_POOL ?= vm-respool # VM resource resource pool
export VSPHERE_DATASTORE ?= datastore1 # VM placement datastore
export VSPHERE_INIT_TYPE ?= thin # vDisk type
export VSPHERE_ADAPTER_TYPE ?= lsiLogic # Virtual disk adapter type

# vi: filetype=make
57 changes: 0 additions & 57 deletions vsphere/README.md

This file was deleted.

Loading

0 comments on commit c46af8d

Please sign in to comment.