Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bb531e8
save changes
yadongyaly Mar 18, 2025
2b5e20e
fix readme formate
yadongyaly Mar 20, 2025
119fbb4
update readme
yadongyaly Mar 20, 2025
7c442c9
Merge branch 'main' of https://github.com/yadongyaly/fabric-terraform…
yadongyaly Mar 20, 2025
6009af9
Update quickstarts/203-fabric-sql-database/README.md
yadongyaly Apr 2, 2025
bcbc5b3
remove authentication part
yadongyaly May 15, 2025
817d0f0
add header and footer
yadongyaly May 15, 2025
a831f35
remove plan
yadongyaly May 15, 2025
333050b
add BEGIN_TF_DOCS
yadongyaly May 15, 2025
92d8f9b
update footer
yadongyaly May 15, 2025
fc96c0f
Merge branch 'main' of https://github.com/yadongyaly/fabric-terraform…
yadongyaly May 15, 2025
e572ddf
update readme
yadongyaly May 15, 2025
9152316
rewrite readme
yadongyaly May 16, 2025
16d51bf
use task docs to generate readme
yadongyaly May 16, 2025
7d6dff8
create main
yadongyaly May 16, 2025
21ad528
task lint
yadongyaly May 16, 2025
b43f0d9
Merge branch 'main' into feat_fabric_sql_database_example
DariuszPorowski May 16, 2025
3656b1f
Merge branch 'main' into feat_fabric_sql_database_example
DariuszPorowski May 17, 2025
027d09e
change it 100
yadongyaly May 19, 2025
6e91164
Merge branch 'feat_fabric_sql_database_example' of https://github.com…
yadongyaly May 19, 2025
f40facd
move to 103 folder
yadongyaly May 19, 2025
f4b2f93
revert last task docs result
yadongyaly May 19, 2025
cdd9bd4
save changes from task docs
yadongyaly May 19, 2025
52d5fd2
run task tool firstly
yadongyaly May 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions quickstarts/203-fabric-sql-database/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Input Variables
- Please fill the input variables in terraform.tfstate file.

| Name | Description | Type | Default | Required |
|-------------------------------------|---------------------------------------------------------------|-------------|---------|----------|
| `fabric_workspace_name` | The name of workspace to be created | string | | true |
| `fabric_sql_database_name` | The name of SQL database to be created | string | | true |
| `fabric_capacity_name` | The existing Fabric Capacity name | string | | true |
| `tenant_id` | The tenant id | string | | true |
| `client_id` | The Application (client) ID. | string | | true |
| `client_certificate_file_path` | The local path of the certificate which needs to pfx format | string | | true |
| `client_certificate_password` | The password of the certificate | string | | true |
| `user_principal_id` | principal_id is the user account object id | string | | true |

## Output Values

| Name | Description |
|--------------------------|---------------------------------------|
| `fabric_workspace_id` | The created Fabric workspace id |
| `fabric_sql_database_id` | The created Fabric SQL database id |

## Prerequisites
- This example requires an existing Fabric capacity.
- This example requires authentication setup. the authenticating method in this example is "Authenticating using a Service Principal and Client Certificate": https://registry.terraform.io/providers/microsoft/fabric/latest/docs/guides/auth_spn_cert

## Usage
- Create a terraform.tfstate file, fill values for all variables in the variables.tf file.
- Execute example with the following commands:

```shell
terraform init
terraform plan
terraform apply
```

## Expected Behavior

The Terraform creates following resources with Service Principal:

- Fabric Workspace. The user is also added as "Admin" role in the workspace.
- Fabric SQL database

## Limitations and Considerations

- This example is provided as a sample only and is not intended for production use without further customization.
7 changes: 7 additions & 0 deletions quickstarts/203-fabric-sql-database/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "fabric_workspace_id" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing description

value = fabric_workspace.example_workspace.id
}

output "fabric_sql_database_id" {
value = fabric_sql_database.example_sql.id
}
21 changes: 21 additions & 0 deletions quickstarts/203-fabric-sql-database/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# We strongly recommend using the required_providers block to set the Fabric Provider source and version being used
terraform {
required_version = ">= 1.8, < 2.0"
required_providers {
fabric = {
source = "microsoft/fabric"
version = "0.1.0-beta.10"
}
}
}

# Configure the Microsoft Fabric Terraform Provider
provider "fabric" {
# Configuration options
preview = true # Farbic SQL database is in preview state.

tenant_id = var.tenant_id
client_id = var.client_id
client_certificate_file_path = var.client_certificate_file_path
client_certificate_password = var.client_certificate_password
}
4 changes: 4 additions & 0 deletions quickstarts/203-fabric-sql-database/sqldatabase.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "fabric_sql_database" "example_sql" {
workspace_id = fabric_workspace.example_workspace.id
display_name = var.fabric_sql_database_name
}
39 changes: 39 additions & 0 deletions quickstarts/203-fabric-sql-database/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
variable "fabric_workspace_name" {
description = "The name of workspace to be created."
type = string
}

variable "fabric_sql_database_name" {
description = "The name of SQL database to be created."
type = string
}

variable "fabric_capacity_name" {
description = "The existing Fabric Capacity name."
type = string
}

variable "tenant_id" {
description = "The tenant id."
type = string
}

variable "client_id" {
description = "The Application (client) ID."
type = string
}

variable "client_certificate_file_path" {
description = "The local path of the certificate which needs to pfx format."
type = string
}

variable "client_certificate_password" {
description = "The password of the certificate."
type = string
}

variable "user_principal_id" {
description = "principal_id is the user account object id."
type = string
}
19 changes: 19 additions & 0 deletions quickstarts/203-fabric-sql-database/workspace.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
data "fabric_capacity" "capacity" {
display_name = var.fabric_capacity_name
}

resource "fabric_workspace" "example_workspace" {
display_name = var.fabric_workspace_name
description = "Getting started workspace"
capacity_id = data.fabric_capacity.capacity.id
}

# by default, the new workspace has only Service Priincile as admin, the user cannot view it on fabric portal
# by adding user as a member, the user can view it on portal
# principal_id is the user account object id
resource "fabric_workspace_role_assignment" "example_workspace_role_assignment" {
workspace_id = fabric_workspace.example_workspace.id
principal_id = var.user_principal_id
principal_type = "User"
role = "Admin"
}
Loading