diff --git a/README.md b/README.md index 4615688..06f8dd2 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,13 @@ $ go build Using the provider ------------------ -Full docs: TODO +To use a released provider in your Terraform environment, run [`terraform init`](https://www.terraform.io/docs/commands/init.html) and Terraform will automatically install the provider. To specify a particular provider version when installing released providers, see the [Terraform documentation on provider versioning](https://www.terraform.io/docs/configuration/providers.html#version-provider-versions). -Example: Create a repository with a non-default entitlement +To instead use a custom-built provider in your Terraform environment (e.g. the provider binary from the build instructions above), follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/plugins/basics.html#installing-plugins) After placing the custom-built provider into your plugins directory, run `terraform init` to initialize it. + +### Examples + +Create a repository with a custom entitlement token ``` provider "cloudsmith" { @@ -57,7 +61,34 @@ resource "cloudsmith_entitlement" "my_entitlement" { } ``` -Developing the Provider +Testing the Provider ----------------------- -TODO +In order to test the provider, you can run `go test`. + +```sh +$ go test -v ./... +``` + +In order to run the full suite of Acceptance tests, you'll need a paid Cloudsmith account. + +You'll also need to set a few environment variables: + +- `TF_ACC=1`: Used to enable acceptance tests during `go test`. +- `CLOUDSMITH_API_KEY`: API key used to manage resources during test runs. +- `CLOUDSMITH_NAMESPACE`: Cloudsmith namespace in which to create and destroy resources under test. + +*Note:* Acceptance tests create real resources, and may cost money to run. + +```sh +$ export TF_ACC=1 +$ export CLOUDSMITH_API_KEY=mykey +$ export CLOUDSMITH_NAMESPACE=mynamespace +$ go test -v ./... +``` + +If needed, you can also run individual tests with the `-run` flag: + +```sh +$ go test -v -run=TestAccEntitlement_basic ./... +```