Skip to content

SumoLogic/terraform-provider-sumologic

Repository files navigation

Terraform logo

Terraform Provider for Sumo Logic

The Terraform Sumo Logic provider is a plugin for Terraform that allows for the full lifecycle management of Sumo Logic resources.

This provider is maintained by Sumo Logic.

Getting started

Using the provider

Run terraform init to automatically install the latest version of the provider.

Requirements

Developing the provider

If you wish to work on the provider, you'll first need Go installed on your machine. You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

Clone repository to: $GOPATH/src/SumoLogic/sumologic-terraform-provider

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

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.

$ cd $GOPATH/src/SumoLogic/terraform-provider-sumologic
$ make build

Testing the provider

In order to test the provider, you can run make test.

For manual testing, run make install in the root directory to install it as a plugin. Then run terraform init to initialize it.

In order to run the full suite of Acceptance tests, run make testacc.

To run a specific acceptance test, run go test -v ./sumologic -run YourSpecificTestName

Note:

  • 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.

    $ export SUMOLOGIC_ACCESSID="yourAccessID"
    $ export SUMOLOGIC_ACCESSKEY="yourAccessKey"
    $ export SUMOLOGIC_ENVIRONMENT="yourEnvironment"
    $ export SUMOLOGIC_BASE_URL="yourEnvironmentAPIUrl"
    $ export TF_ACC=1
    • More information on configuration can be found here.
  • Environment variable SUMOLOGIC_TEST_GOOGLE_APPLICATION_CREDENTIALS must be set for gcp metrics acceptance tests to work properly (ex. below).

    • export SUMOLOGIC_TEST_GOOGLE_APPLICATION_CREDENTIALS=cat /path/to/service_acccount.json
    • Set Environment variable SUMOLOGIC_ENABLE_GCP_METRICS_ACC_TESTS to false, to disable acceptance test for Gcp Metrics.