I'm trying to create a terraform that assigns a Fabric Capacity to a fabric workspace (Power BI.com)
I have managed to create the capacity and the workspaces from terraform but for some reason I keep getting an error on the providers when trying to link the capacity to the workspace.
I'm logging in with Az login and authenticating with an account that has access to both the capacity and workspaces.
main.tf
# Assign workspace to capacity
resource "microsoftfabric_workspace_capacity_assignment" "workspace_assignment" {
workspace_id = var.workspace_id
capacity_id = var.capacity_id
}
variables.tf
variable "workspace_id" {
description = "The ID of the Fabric workspace"
type = string
default = ""
}
variable "capacity_id" {
description = "The ID of the Fabric capacity"
type = string
default = ""
}
providers.tf
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
azapi = {
source = "Azure/azapi"
version = "1.15.0"
}
fabric = {
source = "microsoft/fabric"
version = "0.1.0-beta.4"
}
}
}
provider "azurerm" {
features {}
}
provider "azapi" {
# Configuration options
subscription_id = var.subscription_id
}
provider "fabric" {}
outputs.tf
output "workspace_capacity_assignment_id" {
value = microsoftfabric_workspace_capacity_assignment.workspace_assignment.id
}
The error I keep getting is
Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/microsoftfabric: provider registry registry.terraform.io does not have a provider named
│ registry.terraform.io/hashicorp/microsoftfabric
│
│ All modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending on
│ hashicorp/microsoftfabric, run the following command:
│ terraform providers
I am able to reproduce your issue.
Running terraform providers
command as mentioned in the error message, we can see there are 2 providers related to Microsoft Fabric:
Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/azurerm] ~> 3.0
├── provider[registry.terraform.io/hashicorp/microsoftfabric]
├── provider[registry.terraform.io/hashicorp/random] ~> 3.0
├── provider[registry.terraform.io/azure/azapi] 1.15.0
└── provider[registry.terraform.io/microsoft/fabric] 0.1.0-beta.4
So it seems you're using the wrong provider for the microsoftfabric_workspace_capacity_assignment resource.
Instead of using Microsoft Fabric Provider:
terraform {
required_providers {
# other providers here
fabric = {
source = "microsoft/fabric"
version = "0.1.0-beta.4"
}
}
}
# other providers here
provider "fabric" {}
Try using microsoftfabric Provider provider (managed by Christopher Nagl):
terraform {
required_providers {
# other providers here
microsoftfabric = {
source = "ChristopherNagl/microsoftfabric"
version = "0.5.1"
}
}
}
# other providers here
provider "microsoftfabric" {}
Note:
fabric
to microsoftfabric
in providers.tf
otherwise the same error will occur.