-
Notifications
You must be signed in to change notification settings - Fork 14
feat(103-fabric-sql-database): add new example #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yadongyaly
wants to merge
24
commits into
microsoft:main
Choose a base branch
from
yadongyaly:feat_fabric_sql_database_example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
bb531e8
save changes
yadongyaly 2b5e20e
fix readme formate
yadongyaly 119fbb4
update readme
yadongyaly 7c442c9
Merge branch 'main' of https://github.com/yadongyaly/fabric-terraform…
yadongyaly 6009af9
Update quickstarts/203-fabric-sql-database/README.md
yadongyaly bcbc5b3
remove authentication part
yadongyaly 817d0f0
add header and footer
yadongyaly a831f35
remove plan
yadongyaly 333050b
add BEGIN_TF_DOCS
yadongyaly 92d8f9b
update footer
yadongyaly fc96c0f
Merge branch 'main' of https://github.com/yadongyaly/fabric-terraform…
yadongyaly e572ddf
update readme
yadongyaly 9152316
rewrite readme
yadongyaly 16d51bf
use task docs to generate readme
yadongyaly 7d6dff8
create main
yadongyaly 21ad528
task lint
yadongyaly b43f0d9
Merge branch 'main' into feat_fabric_sql_database_example
DariuszPorowski 3656b1f
Merge branch 'main' into feat_fabric_sql_database_example
DariuszPorowski 027d09e
change it 100
yadongyaly 6e91164
Merge branch 'feat_fabric_sql_database_example' of https://github.com…
yadongyaly f40facd
move to 103 folder
yadongyaly f4b2f93
revert last task docs result
yadongyaly cdd9bd4
save changes from task docs
yadongyaly 52d5fd2
run task tool firstly
yadongyaly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| 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. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| output "fabric_workspace_id" { | ||
|
||
| value = fabric_workspace.example_workspace.id | ||
| } | ||
|
|
||
| output "fabric_sql_database_id" { | ||
yadongyaly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| value = fabric_sql_database.example_sql.id | ||
| } | ||
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
| 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" | ||
yadongyaly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| # 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 | ||
| } | ||
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
| 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 | ||
| } |
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
| 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 | ||
| } |
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
| 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" | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.