Skip to content

Commit

Permalink
fix(ds-workspace): invalid schema for the workspace identity (#16)
Browse files Browse the repository at this point in the history
# 📥 Pull Request

close #15

## ❓ What are you trying to address

This pull request addresses a schema issue in the `fabric_workspace`
data-source and includes related documentation and code updates. The
most important changes include fixing the schema, updating the
documentation, and modifying the relevant code to reflect the schema
change.

## ✨ Description of new changes

Documentation Update:

*
[`docs/data-sources/workspace.md`](diffhunk://#diff-7cd9d7c89e4d61074ba868cdb987ff36a2cd7b06c205e0926cb33a0e37a4c586L70-R71):
Updated the `enabled` attribute to `type` in the workspace identity
documentation.

Bug Fix:

*
[`internal/services/workspace/data_workspace.go`](diffhunk://#diff-56f9c23c9a9645da1fae3a5fb8a2019a63fe3ccc69d44b973c1cc4e733df273bL88-R89):
Modified the schema attribute from `enabled` (bool) to `type` (string)
in the `Schema` function.

Bug Fix:

*
[`internal/testhelp/wellknown.go`](diffhunk://#diff-433c3c086ae764bf7e657e3522ab3449c7b901b01acbe63b857b2d7779e480bfL393-R393):
Fixed a bug where `values.Group.ID` was incorrectly set to `sp.Id`
instead of `group.Id`.
  • Loading branch information
DariuszPorowski authored Sep 26, 2024
1 parent dc25196 commit d666361
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changes/unreleased/fixed-20240925-204940.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: fixed
body: |
The `fabric_workspace` data-source had invalid schema for the workspace identity.
The schema has been changed from `enabled` (bool) to `type` (string).
time: 2024-09-25T20:49:40.662186-07:00
custom:
Issue: "15"
2 changes: 1 addition & 1 deletion docs/data-sources/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ Optional:
Read-Only:

- `application_id` (String) The application ID.
- `enabled` (Boolean) The workspace identity status.
- `service_principal_id` (String) The service principal ID.
- `type` (String) The workspace identity type. Possible values: `SystemAssigned`.
4 changes: 2 additions & 2 deletions internal/services/workspace/data_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func (d *dataSourceWorkspace) Schema(ctx context.Context, _ datasource.SchemaReq
Computed: true,
CustomType: supertypes.NewSingleNestedObjectTypeOf[workspaceIdentityModel](ctx),
Attributes: map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
MarkdownDescription: "The workspace identity status.",
"type": schema.StringAttribute{
MarkdownDescription: "The workspace identity type. Possible values: " + utils.ConvertStringSlicesToString(workspaceIdentityTypes, true, true) + ".",
Computed: true,
},
"application_id": schema.StringAttribute{
Expand Down
2 changes: 1 addition & 1 deletion internal/testhelp/wellknown.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func CreateWellKnownResources() { //nolint:maintidx
panicOnError(err)
log.Printf("Created Entra Group (DisplayName: %s, ObjectID: %s)\n", *group.DisplayName, *group.Id)

values.Group.ID = sp.Id
values.Group.ID = group.Id
values.Group.Type = to.Ptr("Group")

// write the values to the file, pretty printed
Expand Down

0 comments on commit d666361

Please sign in to comment.