Skip to content

Commit

Permalink
Add build and test details to README (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddycarey authored Jun 30, 2020
1 parent d8565a0 commit 56dd811
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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 ./...
```

0 comments on commit 56dd811

Please sign in to comment.