Building The Provider
Clone repository to:
$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers $ git clone email@example.com:terraform-providers/terraform-provider-cf
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-cf $ make build
Using the provider
Download the release binary and copy it to the
$HOME/terraform.d/plugins/<os>_<arch>/terraform-provider-cloudfoundry. For example
/home/youruser/terraform.d/plugins/linux_amd64/terraform-provider-cloudfoundry for a Linux environment or
/Users/youruser/terraform.d/plugins/darwin_amd64/terraform-provider-cloudfoundry for a MacOS environment.
Developing the Provider
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.8+ is required). You'll also need to correctly setup a GOPATH, as well as adding
$GOPATH/bin to your
Clone this repository to
GOPATH/src/github.com/terraform-providers/terraform-provider-cf as its packaging structure
has been defined such that it will be compatible with the Terraform provider plugin framwork in 0.10.x.
To compile the provider, run
make build. This will build the provider and put the provider binary in the
$ make build ... $ $GOPATH/bin/terraform-provider-cf ...
Testing the Provider
To test the provider you will need to run a local PCF Dev instance or launch it in AWS via the
scripts/pcfdev-up.sh. Once the instance is running you will need to export the following environment variables.
export CF_API_URL=https://api.local.pcfdev.io export CF_USER=admin export CF_PASSWORD=admin export CF_UAA_CLIENT_ID=admin export CF_UAA_CLIENT_SECRET=admin-client-secret export CF_CA_CERT="" export CF_SKIP_SSL_VALIDATION=true
You can export the following environment variables to enable detail debug logs.
export CF_DEBUG=true export CF_TRACE=debug.log
In order to run the tests locally, run.
cd cloudfoundry TF_ACC=1 go test -v -timeout 120m .
To run the tests in AWS first launch PCFDev in AWS via
scripts/pcfdev-up.sh, and then run.
Acceptance tests are run against a PCF Dev instance in AWS before a release is created. Any other testing should be done using a local PCF Dev instance.
$ make testacc