terraform-provider-powerbi

command module
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2022 License: MIT Imports: 3 Imported by: 0

README

Terraform Provider for Power BI

Test status

A Terraform provider that allows the creation and updating of Power BI resources

The Power BI Provider supports Terraform 0.12.x. It may still function on earlier versions but has only been tested on 0.12.x and later versions

Installation

Registry

If you use Terraform 0.13 or greater, the provider can be installed from the terraform provider registry by specifying the following item in your terraform

terraform {
  required_providers {
    powerbi = {
      source = "codecutout/powerbi"
      version = "~>1.3"
    }
  }
}
Local

If using terraform 0.12 plugins must be installed locally

  1. From the releases section download the zip file for your desired version, operating system and architecture
  2. Extract the zip file into %APPDATA%\terraform.d\plugins for windows, or ~/.terraform.d/plugins for other systems
  3. terraform init should now detect usage of the provider and apply the plugin

Further details about installing terraform plugs can be found at https://www.terraform.io/docs/plugins/basics.html#installing-plugins

Usage Example

# Configure the Power BI Provider
provider "powerbi" {
  tenant_id       = "..."
  client_id       = "..."
  client_secret   = "..."
  username        = "..."
  password        = "..."
}

# Create a workspace
resource "powerbi_workspace" "example" {
  name     = "Example Workspace"
}

# Create a pbix within the workspace
resource "powerbi_pbix" "example" {
	workspace_id = "${powerbi_workspace.example.id}"
	name = "My PBIX"
	source = "./my-pbix.pbix"
	source_hash = "${filemd5(".my-pbix.pbix")}"
	datasource {
		type = "OData"
		url = "https://services.odata.org/V3/(S(kbiqo1qkby04vnobw0li0fcp))/OData/OData.svc"
		original_url = "https://services.odata.org/V3/OData/OData.svc"
	}
}

Documentation

Provider and resources properties and example usages can be found in this repositories docs folder

Developer Requirements

  • Terraform version 0.12.x +
  • Go version 1.13.x (to build the provider plugin)

If you're on Windows you'll also need:

For Git Bash for Windows, at the step of "Adjusting your PATH environment", please choose "Use Git and optional Unix tools from Windows Command Prompt".*

Developing the Provider

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

Build
$ go build
Documentation generation

Documentation markdown files are partly generated from terraform schema definitions. To regenreate the documentation from updated schema run

$ go run internal/docgen/cmd/main.go
Testing
$ go test -v ./...

The majority of tests in the provider are Acceptance Tests - which provisions real resources in power BI. It's possible to run the acceptance tests with the above command by setting the following enviornment variables:

  • TF_ACC=1
  • POWERBI_TENANT_ID
  • POWERBI_CLIENT_ID
  • POWERBI_CLIENT_SECRET
  • POWERBI_USERNAME
  • POWERBI_PASSWORD
Running with Terraform on Windows
  • Run go build - This will build and deploy terraform-provider-powerbi.exe
  • Run mkdir %APPDATA%\terraform.d\plugins\local.dev\codecutout\powerbi\0.1\windows_amd64 to provison a locally available provider namespace
  • Move the binary to the local namespace: move terraform-provider-powerbi.exe %APPDATA%\terraform.d\plugins\local.dev\codecutout\powerbi\0.1\windows_amd64
  • Use the custom build provider from Terraform:
terraform {
  required_providers {
    powerbi = {
      source  = "local.dev/codecutout/powerbi"
    }
  }
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL