Skip to content

Commit 6e9d5b7

Browse files
committed
Update README for building, running, and testing
1 parent f060c64 commit 6e9d5b7

File tree

1 file changed

+64
-38
lines changed

1 file changed

+64
-38
lines changed

README.md

Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,64 +12,90 @@ The Terraform Sumo Logic provider is a plugin for Terraform that allows for the
1212

1313
This provider is maintained by Sumo Logic.
1414

15+
## Prerequisites
16+
17+
- [Terraform](https://www.terraform.io/downloads.html) >= 0.13
18+
- [Go](https://golang.org/doc/install) >= 1.13 (to build the provider plugin)
19+
- Set [`$GOPATH`](http://golang.org/doc/code.html#GOPATH)
20+
- Add `$GOPATH/bin` to your `$PATH`
21+
- [Sumo Logic](https://www.sumologic.com/)
22+
1523
## Getting started
1624

17-
[Using the provider](https://www.terraform.io/docs/providers/sumologic/)
25+
Add the Sumo Logic provider to your terraform configuration:
1826

19-
Run `terraform init` to automatically install the latest version of the provider.
27+
```
28+
terraform {
29+
required_providers {
30+
sumologic = {
31+
source = "sumologic/sumologic"
32+
version = "" # set the Sumo Logic Terraform Provider version
33+
}
34+
}
35+
}
36+
```
2037

21-
Requirements
22-
------------
38+
Run `terraform init` to automatically install the selected version of the provider.
2339

24-
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x, 0.13x, or 0.14x
25-
- [Go](https://golang.org/doc/install) >= 1.13 (to build the provider plugin)
26-
- [Sumo Logic](https://www.sumologic.com/)
40+
See the [provider documentation](https://www.terraform.io/docs/providers/sumologic/) for information on the supported resources and example usage.
2741

2842
## Developing the provider
2943

30-
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine. You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
31-
32-
Clone repository to: `$GOPATH/src/SumoLogic/sumologic-terraform-provider`
44+
### Build from source
3345

3446
```sh
35-
$ mkdir -p $GOPATH/src/SumoLogic;
36-
$ cd $GOPATH/src/SumoLogic
3747
$ git clone https://github.com/SumoLogic/terraform-provider-sumologic.git
48+
$ cd terraform-provider-sumologic
49+
$ make build
3850
```
3951

40-
Enter the provider directory and build the provider. To compile the provider, run `make build`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
52+
This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
53+
54+
### Run locally-built provider
55+
56+
- Run `make install-dev`
57+
- Update the provider source in your configuration file:
4158

42-
```sh
43-
$ cd $GOPATH/src/SumoLogic/terraform-provider-sumologic
44-
$ make build
4559
```
60+
terraform {
61+
required_providers {
62+
sumologic = {
63+
source = "sumologic.com/dev/sumologic"
64+
version = "~> 1.0.0"
65+
}
66+
}
67+
}
68+
```
69+
70+
## Acceptance tests
4671

47-
## Testing the provider
72+
> **Note:** Acceptance tests create real resources, and often cost money to run.
4873
49-
In order to test the provider, you can run `make test`.
74+
### Configuration
5075

51-
For manual testing, run `make install` in the root directory to install it as a plugin.
52-
Then run `terraform init` to initialize it.
76+
Create a personal access key for your Sumo Logic account, and set the following environment variables.
5377

54-
In order to run the full suite of Acceptance tests, run `make testacc`.
78+
```sh
79+
$ export SUMOLOGIC_ACCESSID="yourAccessID"
80+
$ export SUMOLOGIC_ACCESSKEY="yourAccessKey"
81+
$ export SUMOLOGIC_ENVIRONMENT="yourEnvironment"
82+
$ export SUMOLOGIC_BASE_URL="yourEnvironmentAPIUrl" # not required for most production deployments
83+
$ export TF_ACC=1
84+
```
85+
86+
More information on configuration can be found [here](https://github.com/SumoLogic/terraform-provider-sumologic/blob/master/website/docs/index.html.markdown#environment-variables).
5587

56-
To run a specific acceptance test, run `go test -v ./sumologic -run YourSpecificTestName`
88+
### Run the tests
5789

58-
*Note:*
59-
- Acceptance tests *create real resources*, and often cost money to run. The environment variables `SUMOLOGIC_ACCESSID`, `SUMOLOGIC_ACCESSKEY`, `SUMOLOGIC_ENVIRONMENT` / `SUMOLOGIC_BASE_URL`, and `TF_ACC` must also be set for acceptance tests to work properly. You can generate a personal access key from your environment. Once your test runs, you are then capable of viewing the real resources created by Terraform in the UI.
60-
```sh
61-
$ export SUMOLOGIC_ACCESSID="yourAccessID"
62-
$ export SUMOLOGIC_ACCESSKEY="yourAccessKey"
63-
$ export SUMOLOGIC_ENVIRONMENT="yourEnvironment"
64-
$ export SUMOLOGIC_BASE_URL="yourEnvironmentAPIUrl"
65-
$ export TF_ACC=1
66-
```
67-
- More information on configuration can be found [here](https://github.com/SumoLogic/terraform-provider-sumologic/blob/master/website/docs/index.html.markdown#environment-variables).
90+
```sh
91+
# Run all acceptance tests:
92+
$ make testacc
93+
# Run a specific test:
94+
$ go test -v ./sumologic -run YourSpecificTestName
95+
```
6896

69-
- Environment variable `SUMOLOGIC_TEST_GOOGLE_APPLICATION_CREDENTIALS` must be set for gcp metrics acceptance tests to work properly (ex. below).
70-
- export SUMOLOGIC_TEST_GOOGLE_APPLICATION_CREDENTIALS=`cat /path/to/service_acccount.json`
71-
- Set Environment variable `SUMOLOGIC_ENABLE_GCP_METRICS_ACC_TESTS` to false, to disable acceptance test for Gcp Metrics.
97+
Some tests require additional configuration for interacting with resources external to Sumo Logic:
7298

73-
[0]: https://help.sumologic.com/Manage/Security/Access-Keys
74-
[1]: https://help.sumologic.com/APIs/General_API_Information/Sumo_Logic_Endpoints_and_Firewall_Security
75-
[10]: https://www.terraform.io/docs/providers/sumologic/
99+
- GCP metrics
100+
- `export SUMOLOGIC_TEST_GOOGLE_APPLICATION_CREDENTIALS=$(cat /path/to/service_acccount.json)`
101+
- `export SUMOLOGIC_ENABLE_GCP_METRICS_ACC_TESTS="false"` to disable acceptance tests

0 commit comments

Comments
 (0)