feat: add skip_capacity_state_validation to workspace resource and data source#848
Draft
feat: add skip_capacity_state_validation to workspace resource and data source#848
skip_capacity_state_validation to workspace resource and data source#848Conversation
…rce and data source Add an optional `skip_capacity_state_validation` property (default: false) on the workspace resource and data source. When set to true, the provider will skip calling the List Capacities API to validate the capacity state, which is useful when the caller does not have sufficient permissions to list capacities. Fixes: workspace data source requiring Fabric Capacity admin rights. Co-authored-by: badeamarjieh <127952241+badeamarjieh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix data 'fabric_workspace' requiring Fabric Capacity admin
feat: add Mar 8, 2026
skip_capacity_state_validation to workspace resource and data source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📥 Pull Request
❓ What are you trying to address
The workspace resource and data source call the List Capacities API to validate capacity state, which fails when the caller lacks capacity-level permissions — even if they have sufficient workspace permissions (e.g., Contributor). This makes
data "fabric_workspace"unusable without Fabric Capacity admin rights.✨ Description of new changes
Adds an optional
skip_capacity_state_validationboolean attribute (defaultfalse) to both the workspace resource and data source. Whentrue, the provider skips thevalidateCapacityStatecall that invokes the List Capacities API.skip_capacity_state_validationattribute. Resource:Optional+Computed, defaultfalse. DataSource:Optional. Excluded from list schema.SkipCapacityStateValidationfield ondataSourceWorkspaceModelandresourceWorkspaceModel.validateCapacityStatebehind the flag. Preserve the field through resource Create/Update lifecycle (same pattern asTimeouts).tfplugindocs.Usage
☑️ PR Checklist
☑️ Resources / Data Sources Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
checkpoint-api.hashicorp.com/tmp/go-build1221566023/b001/workspace.test /tmp/go-build1221566023/b001/workspace.test -test.paniconexit0 -test.run=TestUnit_ -test.v=true -test.count=1 -test.timeout=2m0s -I ux-amd64/pkg/tool/linux_amd64/vet --gdwarf-5 openpgp/aes/keyw-atomic mpile ux-amd64/pkg/too-buildtags -p aform-provider-f-errorsas aform-provider-f-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet -I y1305 -I ux-amd64/pkg/too-buildtags(dns block)/usr/local/bin/terraform terraform version -stringintconv -tests /tmp/go-build1221566023/b875/vet.cfg ric-sdk-go@v0.14-errorsas ric-sdk-go@v0.14-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet onfidential.go internal/httpcli-atomic mpile ux-amd64/pkg/too-buildtags -W g_.a mpile ux-amd64/pkg/tool/linux_amd64/vet . go/fabric/mlmode-atomic mpile ux-amd64/pkg/too-buildtags(dns block)/usr/local/bin/terraform /usr/local/bin/terraform version -json -tests /tmp/go-build1221566023/b897/vet.cfg ric-sdk-go@v0.14-errorsas ric-sdk-go@v0.14-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet -p checkpoint l/linux_amd64/cg-bool ux-amd64/pkg/too-buildtags -W g_.a /tmp/go-build377-ifaceassert ux-amd64/pkg/tool/linux_amd64/vet . go/fabric/sqldat-atomic mpile ux-amd64/pkg/too-buildtags(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>[BUG] data "fabric_workspace" requires Fabric Capacity admin</issue_title>
<issue_description>### 🐛 What happened?
I'm running pipeline using Managed Identity having Workspace Contributor rights on "Workspace-Team1-2-DEV" workspace.
I expect that data "fabric_workspace" will return information about workspace without necessity of having Fabric Capacity Admin rights (which quite often is shared).
🔬 How to reproduce?
It will end up with error:
╷
│ Error: Read operation
│
│ with data.fabric_workspace.workspace_details,
│ on main.tf line 3, in data "fabric_workspace" "workspace_details":
│ 3: data "fabric_workspace" "workspace_details" {
│
│ Unable to find Capacity with 'id': 4a4c7882-d123-4c99-b9da-11111111
After granting for the same user Fabric Capacity Admin role, the code executes properly and returns workspace details:
+ capacity_assignment_progress = "Completed"
+ capacity_id = "4a4c7882-d123-4c99-b9da-11111111"
+ capacity_region = "Germany West Central"
+ description = "POC"
+ display_name = "Workspace-Team1-2-DEV"
+ id = "3213321-3232-32332-323232-3232-3232"
+ identity = null
+ onelake_endpoints = {
+ blob_endpoint = "https://germanywestcentral-onelake.blob.fabric.microsoft.com"/
+ dfs_endpoint = "https://germanywestcentral-onelake.dfs.fabric.microsoft.com"/
}
+ timeouts = null
+ type = "Workspace"
}
🏗️ Code Sample / Log
code:
error:
📷 Screenshots
No response
📈 Expected behavior
Account having workspace level permission, should be able to read workspace details without necessity of having admin rights on the Fabric Capacity.
🌌 Environment (Provider Version)
1.6.0
🌌 Environment (Terraform Version)
1.12.2
🌌 Environment (OS)
Linux
📎 Additional context
No response
🔰 Code of Conduct
<agent_instructions>See the issue and the proposed solution, and implement it based on best practices and consistent with the existing code and architecture.</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@badeamarjieh hi @slawchod, thanks for reporting the issue. we were able to reproduce and identify the problem. we will keep you updated! @badeamarjieh hi @slawchod The provider calls [List Capacities](https://learn.microsoft.com/en-us/rest/api/fabric/core/capacities/list-capacities?tabs=HTTP) API to validate that the capacity is Active. This is intended to protect the provider users from scenarios where you apply terraform plan with 1. workspace assigned to an **active** capacity 2. at least one item in this workspaceand then the capacity gets suspended. In this case, rerunning terraform apply would break the state as all items inside this workspace will have not found as API response.
The user does not have to be an admin role on the capacity, rather contributor is enough </comment_new>
<comment_new>@badeamarjieh
Hey @slawchod
The permission on the capacity is controlled from the Fabric Portal and not from Azure: https://learn.microsoft.com/en-us/fabric/admin/capacity-settings?tabs=fabric-capacity</comment_new>
<comment_new>@badeamarjieh
The issue as described above:
"
This is intended to protect the provider users from scenarios where you apply terraform plan with
and then the capacity gets suspended. In this case, rerunning terraform apply would break the state as all items inside this workspace will have not found as API response.
"
Whether it's a data workspace or a resource workspace, the issue still fits in both cases.
Unless the workspace capacity state is not returned in the Get Workspace API - we have to call the List Capacities API to check the state to not break the terraform state.
This is by design and not a bug...
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.