Coder Social home page Coder Social logo

terraform-provider-powerbi's Introduction

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"
    }
  }
}

terraform-provider-powerbi's People

Contributors

alex-davies avatar alxy avatar dependabot[bot] avatar ladlavj avatar vijaykumar-u avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.