codecutout / terraform-provider-powerbi

Terraform Power BI Provider
MIT License
14 stars 16 forks source link

[FEATURE REQUEST] workspace import #71

Closed mikemowgli closed 2 years ago

mikemowgli commented 2 years ago

I have a bunch of workspaces manually created by users. I'd now like to bring more structure and automation, and manage them as code. Unfortunately, it's not possible to import them. And obviously I cannot delete and recreate them, since I'd then lose all their content.

EatZeBaby commented 2 years ago

image I just tried on my end and it seems to work. The Workspace ID is the UUID you can find in the URL after groups/

If you use Powershell, you can also get the IDs of all your workspace with the Cmdlet Get-PowerBIWorkspace -All

image

mikemowgli commented 2 years ago

Sorry for not replying. ths was out of my radar. I just tried, and this is what I get: terraform import powerbi_workspace.tamers_pbi_workspace[\"Data\ Tamers\ -\ Internal\"] "dfdbREDACTEDb94" [...] Error: Cannot import non-existent remote object │ │ While attempting to import an existing object to "powerbi_workspace.tamers_pbi_workspace[\"Data Tamers - Internal\"]", the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that │ the id is correct and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.

I of course checked that the workspace exists, the ID is correct, and the provider's config has permission over this workspace.

mikemowgli commented 2 years ago

Ok, I got it. Here's the explanation: For terraform to import my workspace, I manually added Admin rights to the Service Principal on the workspace. Then it was failing to import because it seems that Power BI takes quite some time to take new permissions into account. So trying later just fixed it. Closing. Thanks for the support. The import should probably documented though.