-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sql_database): onboard new resource/data-source
- Loading branch information
1 parent
7bb751d
commit 1c090dd
Showing
20 changed files
with
922 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,5 @@ | ||
kind: added | ||
body: Onboard new resource/data-source `fabric_sql_database`. | ||
time: 2025-02-28T09:26:31.2402351-08:00 | ||
custom: | ||
Issue: "255" |
This file contains 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,67 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "fabric_sql_database Data Source - terraform-provider-fabric" | ||
subcategory: "" | ||
description: |- | ||
Get a Fabric SQL Database. | ||
Use this data source to fetch a SQL Database https://learn.microsoft.com/fabric/database/sql/overview. | ||
-> This item supports Service Principal authentication. | ||
~> This data-source is in preview. To access it, you must explicitly enable the preview mode in the provider level configuration. | ||
--- | ||
|
||
# fabric_sql_database (Data Source) | ||
|
||
Get a Fabric SQL Database. | ||
|
||
Use this data source to fetch a [SQL Database](https://learn.microsoft.com/fabric/database/sql/overview). | ||
|
||
-> This item supports Service Principal authentication. | ||
|
||
~> This data-source is in **preview**. To access it, you must explicitly enable the `preview` mode in the provider level configuration. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "fabric_sql_database" "example_by_id" { | ||
id = "11111111-1111-1111-1111-111111111111" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
data "fabric_sql_database" "example_by_name" { | ||
display_name = "example" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
# This is an invalid data source | ||
# Do not specify `id` and `display_name` in the same data source block | ||
# data "fabric_sql_database" "example" { | ||
# display_name = "example" | ||
# id = "11111111-1111-1111-1111-111111111111" | ||
# workspace_id = "00000000-0000-0000-0000-000000000000" | ||
# } | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `workspace_id` (String) The Workspace ID. | ||
|
||
### Optional | ||
|
||
- `display_name` (String) The SQL Database display name. | ||
- `id` (String) The SQL Database ID. | ||
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `description` (String) The SQL Database description. | ||
|
||
<a id="nestedatt--timeouts"></a> | ||
|
||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). |
This file contains 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,62 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "fabric_sql_databases Data Source - terraform-provider-fabric" | ||
subcategory: "" | ||
description: |- | ||
List a Fabric SQL Databases. | ||
Use this data source to list SQL Databases https://learn.microsoft.com/fabric/database/sql/overview. | ||
-> This item supports Service Principal authentication. | ||
~> This data-source is in preview. To access it, you must explicitly enable the preview mode in the provider level configuration. | ||
--- | ||
|
||
# fabric_sql_databases (Data Source) | ||
|
||
List a Fabric SQL Databases. | ||
|
||
Use this data source to list [SQL Databases](https://learn.microsoft.com/fabric/database/sql/overview). | ||
|
||
-> This item supports Service Principal authentication. | ||
|
||
~> This data-source is in **preview**. To access it, you must explicitly enable the `preview` mode in the provider level configuration. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "fabric_sql_databases" "example" { | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `workspace_id` (String) The Workspace ID. | ||
|
||
### Optional | ||
|
||
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `values` (Attributes List) The list of SQL Databases. (see [below for nested schema](#nestedatt--values)) | ||
|
||
<a id="nestedatt--timeouts"></a> | ||
|
||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). | ||
|
||
<a id="nestedatt--values"></a> | ||
|
||
### Nested Schema for `values` | ||
|
||
Read-Only: | ||
|
||
- `description` (String) The SQL Database description. | ||
- `display_name` (String) The SQL Database display name. | ||
- `id` (String) The SQL Database ID. | ||
- `workspace_id` (String) The Workspace ID. |
This file contains 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,48 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "fabric_sql_database Resource - terraform-provider-fabric" | ||
subcategory: "" | ||
description: |- | ||
Manage a Fabric SQL Database. | ||
Use this resource to manage SQL Database https://learn.microsoft.com/fabric/database/sql/overview. | ||
-> This item supports Service Principal authentication. | ||
~> This resource is in preview. To access it, you must explicitly enable the preview mode in the provider level configuration. | ||
--- | ||
|
||
# fabric_sql_database (Resource) | ||
|
||
Manage a Fabric SQL Database. | ||
|
||
Use this resource to manage [SQL Database](https://learn.microsoft.com/fabric/database/sql/overview). | ||
|
||
-> This item supports Service Principal authentication. | ||
|
||
~> This resource is in **preview**. To access it, you must explicitly enable the `preview` mode in the provider level configuration. | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `display_name` (String) The SQL Database display name. | ||
- `workspace_id` (String) The Workspace ID. | ||
|
||
### Optional | ||
|
||
- `description` (String) The SQL Database description. | ||
- `timeouts` (Attributes) (see [below for nested schema](#nestedatt--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The SQL Database ID. | ||
|
||
<a id="nestedatt--timeouts"></a> | ||
|
||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). | ||
- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs. | ||
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled. | ||
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). |
This file contains 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,17 @@ | ||
data "fabric_sql_database" "example_by_id" { | ||
id = "11111111-1111-1111-1111-111111111111" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
|
||
data "fabric_sql_database" "example_by_name" { | ||
display_name = "example" | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} | ||
|
||
# This is an invalid data source | ||
# Do not specify `id` and `display_name` in the same data source block | ||
# data "fabric_sql_database" "example" { | ||
# display_name = "example" | ||
# id = "11111111-1111-1111-1111-111111111111" | ||
# workspace_id = "00000000-0000-0000-0000-000000000000" | ||
# } |
This file contains 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 "example_by_id" { | ||
value = data.fabric_sql_database.example_by_id | ||
} | ||
|
||
output "example_by_name" { | ||
value = data.fabric_sql_database.example_by_name | ||
} |
This file contains 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,11 @@ | ||
terraform { | ||
required_version = ">= 1.8, < 2.0" | ||
required_providers { | ||
fabric = { | ||
source = "microsoft/fabric" | ||
version = "0.0.0" # Check for the latest version on the Terraform Registry | ||
} | ||
} | ||
} | ||
|
||
provider "fabric" {} |
This file contains 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,3 @@ | ||
data "fabric_sql_databases" "example" { | ||
workspace_id = "00000000-0000-0000-0000-000000000000" | ||
} |
This file contains 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,3 @@ | ||
output "example" { | ||
value = data.fabric_sql_databases.example | ||
} |
This file contains 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,11 @@ | ||
terraform { | ||
required_version = ">= 1.8, < 2.0" | ||
required_providers { | ||
fabric = { | ||
source = "microsoft/fabric" | ||
version = "0.0.0" # Check for the latest version on the Terraform Registry | ||
} | ||
} | ||
} | ||
|
||
provider "fabric" {} |
This file contains 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
This file contains 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 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package sqldatabase | ||
|
||
import ( | ||
fabcore "github.com/microsoft/fabric-sdk-go/fabric/core" | ||
|
||
"github.com/microsoft/terraform-provider-fabric/internal/common" | ||
) | ||
|
||
const ( | ||
ItemName = "SQL Database" | ||
ItemTFName = "sql_database" | ||
ItemsName = "SQL Databases" | ||
ItemsTFName = "sql_databases" | ||
ItemType = fabcore.ItemTypeSQLDatabase | ||
ItemDocsSPNSupport = common.DocsSPNSupported | ||
ItemDocsURL = "https://learn.microsoft.com/fabric/database/sql/overview" | ||
ItemPreview = true | ||
) |
This file contains 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,14 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package sqldatabase_test | ||
|
||
import ( | ||
"github.com/microsoft/terraform-provider-fabric/internal/services/sqldatabase" | ||
) | ||
|
||
const ( | ||
itemTFName = sqldatabase.ItemTFName | ||
itemsTFName = sqldatabase.ItemsTFName | ||
itemType = sqldatabase.ItemType | ||
) |
This file contains 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,25 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package sqldatabase | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-framework/datasource" | ||
|
||
"github.com/microsoft/terraform-provider-fabric/internal/pkg/fabricitem" | ||
) | ||
|
||
func NewDataSourceSQLDatabase() datasource.DataSource { | ||
config := fabricitem.DataSourceFabricItem{ | ||
Type: ItemType, | ||
Name: ItemName, | ||
TFName: ItemTFName, | ||
MarkdownDescription: "Get a Fabric " + ItemName + ".\n\n" + | ||
"Use this data source to fetch a [" + ItemName + "](" + ItemDocsURL + ").\n\n" + | ||
ItemDocsSPNSupport, | ||
IsDisplayNameUnique: true, | ||
IsPreview: ItemPreview, | ||
} | ||
|
||
return fabricitem.NewDataSourceFabricItem(config) | ||
} |
Oops, something went wrong.