Skip to content
Terraform VMware vCloud Director provider
Go HCL Shell Other
Branch: master
Clone or download
Didainius Add usage note in build section of README.md (#301)
* Add usage note near build guide in README.md
Latest commit ad0a400 Aug 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Make CoC and support channels more visible Nov 1, 2017
ResourceExamples Implement Issue #250 - part 2 (#253) May 24, 2019
scripts Add Org data source (#283) Aug 2, 2019
test-resources Add media resource for VDC provider (#125) Dec 11, 2018
vcd Add Org data source (#283) Aug 2, 2019
vendor
website Add Org data source (#283) Aug 2, 2019
.gitignore Add load balancer service monitor resource and datasource (#256) Jun 14, 2019
.travis.yml Migrate dependency to terraform 0.11.13 (Closes #181) (#183) Mar 13, 2019
CHANGELOG.md Bump Terraform SDK dependency to 0.12.6 (#302) Aug 13, 2019
GNUmakefile Add Org data source (#283) Aug 2, 2019
LICENSE initial commit Jun 5, 2017
README.md Add usage note in build section of README.md (#301) Aug 13, 2019
TESTING.md Add org user (#279) Jul 11, 2019
VERSION Add Catalog and media item attribute metadata (#298) Aug 2, 2019
go.mod Bump Terraform SDK dependency to 0.12.6 (#302) Aug 13, 2019
go.sum Bump Terraform SDK dependency to 0.12.6 (#302) Aug 13, 2019
main.go Start using Go modules (#178) Mar 5, 2019

README.md

Terraform vCloud Director Provider

The official Terraform provider for VMware vCloud Director

Part of Terraform

Requirements

Building The Provider (the modules way)

Note. You only need to build the provider plugin if you want to develop it. Refer to documentation for using it. Terraform will automatically download officially released binaries of this provider plugin on the first run of terraform init command.

Starting with version 2.1 provider started using Go modules This means that it is no longer necessary to be in GOPATH. See more on how to use modules and toggle between modes.

$ cd ~/mydir
$ git clone https://github.com/terraform-providers/terraform-provider-vcd.git
$ cd terraform-provider-vcd/
$ make build

Building The Provider (the old vendor way)

Prior to version 2.1 provider used Go vendor directory for dependency management. This method is not recommended anymore, but can be used to build provider on Go versions < 1.11.

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-vcd

$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers
$ git clone https://github.com/terraform-providers/terraform-provider-vcd.git

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-vcd
$ make build

Developing the Provider

Starting with terraform-provider-vcd version 2.1 Go modules are used, while vendor directory is left for backwards compatibility only. This means a few things:

  • The code no longer needs to stay in your GOPATH. It can though - see more on how to use modules and toggle between modes.
  • vendor directory is not to be changed manually. Always use Go modules when introducing new dependencies and always rebuild the vendor directory using go mod vendor if you have changed go.mod or go.sum. Travis CI will catch and fail if it is not done.
  • When developing terraform-provider-vcd one often needs to add extra stuff to go-vcloud-director. Go modules have a convenient replace directive which can allow you to redirect import path to your own version of go-vcloud-director. go.mod can be altered:
  • You can replace your import with a forked branch like this:
   module github.com/terraform-providers/terraform-provider-vcd/v2
   require (
   	...
   	github.com/vmware/go-vcloud-director/v2 v2.1.0-alpha.2
   	)
   replace github.com/vmware/go-vcloud-director/v2 v2.1.0-alpha.2 => github.com/my-git-user/go-vcloud-director/v2 v2.1.0-alpha.2    
  • You can also replace pointer to a branch with relative directory
    module github.com/terraform-providers/terraform-provider-vcd/v2
    require (
    	...
    	github.com/vmware/go-vcloud-director/v2 v2.1.0-alpha.2
    	)
    replace github.com/vmware/go-vcloud-director/v2 v2.1.0-alpha.2 => ../go-vcloud-director

Using the provider

Installing the built provider

For a more thorough test using the Terraform client, you may want to transfer the plugin in the Terraform directory. A make command can do this for you:

$ make install

This command will build the plugin and transfer it to $HOME/.terraform.d/plugins, with a name that includes the version (as taken from the ./VERSION file).

Using the new plugin

Once you have installed the plugin as mentioned above, you can simply create a new config.tf as defined in the manual and run

$ terraform init
$ terraform plan
$ terraform apply
You can’t perform that action at this time.