Microsoft & Terraform
This project provisions and manages Microsoft Fabric resources locally with Terraform.
Resources Created
- Microsoft Fabric Workspace
- Notebook
- Lakehouse
Prerequisites
Before running this project, ensure you have:
- Terraform CLI installed (version >= 1.8)
- Download from Terraform website
- Verify installation:
terraform -v
- Microsoft Fabric Capacity provisioned in Azure
- Note the capacity name for use in the configuration
- Authentication configured for Microsoft Fabric Terraform Provider
- Create a service principal in Azure AD
- Assign appropriate permissions
- Set the following environment variables:
export ARM_CLIENT_ID="your-client-id"
export ARM_CLIENT_SECRET="your-client-secret"
export ARM_TENANT_ID="your-tenant-id"
export ARM_SUBSCRIPTION_ID="your-subscription-id"
Project Structure
terraform_demo/
├── provider.tf # Terraform provider configuration
├── variables.tf # Input variables definition
├── workspace.tf # Fabric workspace configuration
├── notebook.tf # Fabric notebook configuration
├── lakehouse.tf # Fabric lakehouse configuration
├── outputs.tf # Output variables definition
├── terraform.tfvars # Variable values
├── notebook.ipynb # Sample notebook definition
└── README.md # Project documentation
Configuration
Before running the project, update the terraform.tfvars
file with your specific values:
workspace_display_name = "example workspace"
notebook_display_name = "example notebook"
notebook_definition_update_enabled = true
notebook_definition_path = "notebook.ipynb"
capacity_name = "your-capacity-name" # Replace with your actual capacity name
lakehouse_display_name = "example lakehouse"
Running the Project Locally
- Clone this repository or copy all files to a new directory
- Navigate to the project directory
- Initialize Terraform:
terraform init
- Plan the changes:
terraform plan -out=plan.tfplan
- Apply the changes:
terraform apply plan.tfplan
- After applying, Terraform will output the IDs of the created resources
Cleaning Up
To remove all created resources:
terraform destroy
Troubleshooting
If you encounter any issues:
- Verify your authentication credentials
- Ensure your Fabric Capacity is properly provisioned
- Check the capacity name in your
terraform.tfvars
file - Refer to the Troubleshooting guide in the official documentation