Skip to content

devoteamgcloud/terraform-provider-looker

Repository files navigation

Visitors Open issues Latest release

Terraform provider for Looker

Terraform provider for looker, built without dependencies on official go-sdk. Autogenerated terraform docs available at Looker Documentation.
Provider available at Terraform registry.

License

This repository is open source, please refer to the License for more information.

Getting Started & Documentation

If you're new to Terraform and want to get started creating infrastructure, please check out the Terraform official Getting Started guides on HashiCorp's learning platform. There are also additional guides to continue your learning.

Use the provider

terraform {
  required_providers {
    looker = {
      source  = "devoteamgcloud/looker"
      version = "x.x.x"
    }
  }
}

provider "looker" {
  base_url      = "https://org.cloud.looker.com:19999/api/" # Optionally use env var LOOKER_BASE_URL !!! use /api/ at the end of your url !!!
  client_id     = "xxxxxxxx"                                # Optionally use env var LOOKER_API_CLIENT_ID
  client_secret = "xxxxxxxx"                                # Optionally use env var LOOKER_API_CLIENT_SECRET
}

Developing the provider

To learn more about how to contribute to the development of this provider please refer to the community guidelines.

Did you find a vulnerability? Please refer to the Security Policy for more information.

Makefile

The make command provides an easy way to access commands for local development of the provider.

  • To build the provider locally, you can execute the make command at the root of the project.

    make build
    

    Alternatively: 'go build -o terraform-provider-looker'

  • To format all the go files in the project.

    make format
    

    Alternatively: 'gofmt -l -s -w .'

  • To generate documentation using the tfplugindocs plugin.

    make docs
    

    Alternatively: 'go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs'

Use locally built provider

  1. Create directory~/.terraform.d/plugins/hashicorp.local/devoteamgcloud/looker/{version}/{architecture} eg mkdir -p ~/.terraform.d/plugins/hashicorp.local/devoteamgcloud/looker/0.1.2/linux_amd64

  2. Move the built file terraform-provider-looker from build/devoteamgcloud/{version}/terraform-provider-looker to the directory created in step 1.

  3. You can use the provider now by setting the source to "hashicorp.local/devoteamgcloud/looker"

    terraform {  
       required_providers {  
          looker = { 
             source  = "hashicorp.local/devoteamgcloud/looker" 
             version = "x.x.x" 
          } 
       } 
    }
    

Notes

Looker doesn't support concurrent operations on their database. That's why we are required to limit parallelism to 1 during the applying of heavy operations with multiple user creations. Here is how to do it:

terraform apply -parallelism=1

If parallelism is not limited, the Looker API may return 500 exceptions for heavy operations.