Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue taking over dataset ownership #42

Open
ghost opened this issue May 20, 2021 · 2 comments
Open

Issue taking over dataset ownership #42

ghost opened this issue May 20, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented May 20, 2021

Hi there, I'm having trouble updating report params and datasources

Terraform Version

14.0.3

Affected Resource(s)

  • resource "powerbi_pbix"

Environment variable names

Azure Managed

Terraform Configuration Files

terraform {
  required_providers {
    powerbi = {
      source  = "codecutout/powerbi"
      version = "1.3.1"
    }
  }
}

variable "client_secret" {
  type = string
}

provider "powerbi" {
  tenant_id     = local.tenantid
  client_id       = local.appid
  client_secret = var.client_secret
}

data "powerbi_workspace" "myworkspace" {
  name = local.WorkspaceName
}

resource "powerbi_pbix" "pbis" {

  for_each          = local.reports
  workspace_id = data.powerbi_workspace.myworkspace.id
  name             = each.value.name
  source           = each.value.pbixfilename
  source_hash  = filemd5(each.value.pbixfilename)

  datasource {
    type            = each.value.datasource.type
    url               = each.value.datasource.url
    original_url = each.value.datasource.original_url
  }

  dynamic "parameter" {
    for_each = each.value.datasource.parameters.updateDetails
    content {
      name  = parameter.value.name
      value = parameter.value.newValue
    }
  }

}

Debug Output

For each report:

Error: Post "https://api.powerbi.com/v1.0/myorg/groups/e8/datasets/d7/Default.UpdateDatasources": status code '403 Forbidden' with body {"error":{"code":"InvalidRequest","message":"This operation is only supported for the dataset owner"}}
2021-05-20T11:11:46.5792582Z 
2021-05-20T11:11:46.5793361Z   on main.tf line 24, in resource "powerbi_pbix" "pbis":
2021-05-20T11:11:46.5794609Z   24: resource "powerbi_pbix" "pbis" {
2021-05-20T11:11:46.5794930Z 

Expected Behavior

No Errors

Actual Behavior

Terraform Error printed and ignored

Steps to Reproduce

terraform apply with pbi resources already deployed manually

@alex-davies
Copy link
Collaborator

The provider currently doesn't take over ownership. Most of our use and test cases the user already has ownership as they created the initial report

But I agree this would be a useful thing thing to have, particularly if using a service principal where it is more difficult to get back ownership once its been lost. I am happy to accept PRs

@ghost
Copy link
Author

ghost commented May 21, 2021

I tried to lay ground for this with pr #43 somewhere in the provider, it's certainly far from required but something to get the tracks on rolling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant