The Terraform provider for Lightdash enables you to manage your Lightdash resources with ease.
Below is a step-by-step example demonstrating how to assign the editor role to a user at the project level using Terraform.
# Set up the Lightdash provider
terraform {
required_providers {
lightdash = {
source = "ubie-oss/lightdash"
version = "0.4.2"
}
}
}
provider "lightdash" {
host = "https://app.lightdash.cloud" # Replace with your Lightdash host
token = var.personal_access_token # Replace with your personal access token
}
# Retrieve details about the organization
data "lightdash_organization" "my_organization" {}
# Retrieve details about a specific user within the organization
data "lightdash_organization_member" "test_user" {
organization_uuid = data.lightdash_organization.my_organization.organization_uuid
email = "[email protected]"
}
# Retrieve details about a specific project
data "lightdash_project" "jaffle_shop" {
project_uuid = "xxxx-xxxx-xxxx" # Replace with your project's UUID
}
# Assign the editor role to the user for the specified project
resource "lightdash_project_role_member" "test" {
project_uuid = data.lightdash_project.jaffle_shop.project_uuid
user_uuid = data.lightdash_organization_member.test_user.user_uuid
role = "editor"
}
- Terraform version 1.1 or higher
- Go version 1.19 or higher
To build the Lightdash provider from source:
- Clone the repository to your local machine.
- Navigate to the repository directory.
- Execute the following command to build the provider:
go install
The Lightdash provider is built using Go modules. For the latest guidelines on using Go modules, refer to the Go modules documentation.
To add a new Go module dependency, for example github.com/author/dependency
, use the following commands:
go get github.com/author/dependency
go mod tidy
Afterwards, commit the updated go.mod
and go.sum
files to your version control system.
To use the provider, follow the instructions in the Usage Guide section above.
If you're interested in contributing to the development of the Lightdash provider, ensure you have Go installed on your system (refer to Prerequisites).
To compile the provider, run go install
. This will build the provider binary and place it in the $GOPATH/bin
directory.
To update or generate new documentation, use the go generate
command.
For running the full suite of Acceptance tests, which create actual resources and may incur costs, execute:
make testacc
Contributions to the terraform-provider-lightdash
are welcome! Check out our CONTRIBUTING.md for guidelines on how to get involved.
We advise against using group-level space access control at this time, as it requires further improvements to ensure optimal functionality.