Skip to content

resolutionlife/terraform-provider-looker

Repository files navigation

Terraform Provider for Looker

A terraform provider to provision Looker resources.

Documentation

Documentation for each resource and data source supported can be found here.

Installation

Terraform uses the Terraform Registry to download and install providers. To install this provider, copy and paste the following code into your Terraform configuration. Then, run terraform init.

terraform {
  required_providers {
    looker = {
      source  = "resolutionlife/looker"
      version = ">= 0.1.0" # See docs for latest version`
    }
  }
}

provider "looker" {}
$ terraform init

Running the provider locally

To run the terraform provider locally, run make install. This command builds a binary of the provider and stores it locally. Then, run terraform init using the below configuration.

Note: To configure the provider, an API key and secret are required for your looker instance. See the documentation on creating an API key. You must be an admin to create an API key.

terraform {
  required_providers {
    looker = {
      source  = "terraform.example.com/local/looker"
      version = "0.0.1"
    }
  }
}

provider "looker" {
    base_url      = "https://my-instance.cloud.looker.com"
    client_id     = "my-client-id"
    client_secret = "my-client-secret"
}
$ make install
$ terraform init

Environment variables

You can configure the provider with the LOOKERSDK_BASE_URL, LOOKERSDK_CLIENT_ID, LOOKERSDK_CLIENT_SECRET environment variables. You can also skip SSL verification with LOOKERSDK_VERIFY_SSL and define the timeout duration with LOOKERSDK_TIMEOUT. For example

LOOKERSDK_BASE_URL="<my-instance-url>" \
LOOKERSDK_CLIENT_ID="<my-client-id>" \
LOOKERSDK_CLIENT_SECRET="<my-client-secret>" \

Logging and Debugging

This provider supports logging and debugging to provide insights and aid debugging. To view the log outputs, set the TF_LOG_PROVIDER environment variable to the desired log level. For example:

export TF_LOG_PROVIDER=INFO

See the official documentation for details on each log level.

Acceptance testing

Acceptance tests run against a test looker instance as part of the developer workflow. To run acceptance testing locally, run the following:

make testacc

Sweepers are available to clean up dangling resources that can occur when acceptance tests fail. To run the sweeper, run the following:

make sweep