Infrastructure as Code (IaC) is a game-changer for managing cloud resources consistently and at scale. In this post, I want to share how we can use Terraform to create Microsoft Fabric workspaces, making the process repeatable and version-controlled.
Why Terraform?
- Vendor-neutral approach: Starting with Fabric as the provider, but the design allows adding Azure, AWS, or GCP later. This avoids vendor lock-in.
- Scalability: Define once, deploy many times across environments.
- Consistency: Reduce manual errors and enforce standards.
Key Files in the Setup
provider.tf- Declares the Fabric provider.
- Future-ready: can include multiple providers (Azure, AWS, GCP).
main.tf- Core logic for creating workspaces, lakehouses, warehouses, and folders.
terraform.tfvars- Maps workspace configurations dynamically.
- Example snippet:
Execution
terraform init
This sets up the working directory and downloads the required provider plugins.
terraform plan -out=tfplan
Generates an execution plan and saves it to tfplan so you can review changes before applying.
terraform apply tfplan
Executes the plan and provisions the Fabric workspaces as defined in your configuration.
The screenshots below show the commands being executed and, finally, the Fabric UI confirming that the workspaces have been set up correctly.
Conclusion
By using Infrastructure as Code, we eliminate the need to click through the UI and manually create workspaces repeatedly. Everything can be managed through code, making deployments consistent, auditable, and scalable. With just one command, you can provision multiple workspaces in seconds.