Skip to content

Commit fe687a3

Browse files
folder_resource: remove personal field as it's not meant to be set manually
1 parent 5c12094 commit fe687a3

File tree

3 files changed

+1
-15
lines changed

3 files changed

+1
-15
lines changed

docs/resources/folder.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ resource "passbolt_folder" "basic" {
2121
# Full Passbolt Folder Configuration
2222
resource "passbolt_folder" "full" {
2323
name = "My Folder"
24-
personal = true
2524
folder_parent_id = "Parent Folder"
2625
}
2726
```
@@ -36,7 +35,6 @@ resource "passbolt_folder" "full" {
3635
### Optional
3736

3837
- `folder_parent_id` (String) The ID of the parent folder
39-
- `personal` (Boolean) If the folder is a personal folder.
4038

4139
### Read-Only
4240

examples/resources/passbolt_folder/resource.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ resource "passbolt_folder" "basic" {
66
# Full Passbolt Folder Configuration
77
resource "passbolt_folder" "full" {
88
name = "My Folder"
9-
personal = true
109
folder_parent_id = "Parent Folder"
1110
}

internal/provider/folder_resource.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
"github.com/hashicorp/terraform-plugin-framework/resource"
88
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
9-
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
109
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
1110
"github.com/hashicorp/terraform-plugin-framework/types"
1211
"github.com/passbolt/go-passbolt/api"
@@ -32,7 +31,6 @@ type folderResource struct {
3231
type foldersModelCreate struct {
3332
ID types.String `tfsdk:"id"`
3433
Name types.String `tfsdk:"name"`
35-
Personal types.Bool `tfsdk:"personal"`
3634
FolderParentId types.String `tfsdk:"folder_parent_id"`
3735
}
3836

@@ -79,12 +77,6 @@ func (r *folderResource) Schema(_ context.Context, _ resource.SchemaRequest, res
7977
Computed: true,
8078
Default: stringdefault.StaticString(""),
8179
},
82-
"personal": schema.BoolAttribute{
83-
Description: "If the folder is a personal folder.",
84-
Computed: true,
85-
Optional: true,
86-
Default: booldefault.StaticBool(true),
87-
},
8880
},
8981
}
9082
}
@@ -108,7 +100,6 @@ func (r *folderResource) Create(ctx context.Context, req resource.CreateRequest,
108100
// Generate API request body from plan
109101
var folder = api.Folder{
110102
Name: plan.Name.ValueString(),
111-
Personal: plan.Personal.ValueBool(),
112103
FolderParentID: plan.FolderParentId.ValueString(),
113104
}
114105

@@ -130,6 +121,7 @@ func (r *folderResource) Create(ctx context.Context, req resource.CreateRequest,
130121

131122
// Map response body to schema and populate Computed attribute values
132123
plan.ID = types.StringValue(cFolder.ID)
124+
plan.FolderParentId = types.StringValue(cFolder.FolderParentID)
133125

134126
// Set state to fully populated data
135127
diags = resp.State.Set(ctx, plan)
@@ -160,7 +152,6 @@ func (r *folderResource) Read(ctx context.Context, req resource.ReadRequest, res
160152

161153
state.ID = types.StringValue(folder.ID)
162154
state.Name = types.StringValue(folder.Name)
163-
state.Personal = types.BoolValue(folder.Personal)
164155
state.FolderParentId = types.StringValue(folder.FolderParentID)
165156

166157
// Set state to fully populated data
@@ -184,7 +175,6 @@ func (r *folderResource) Update(ctx context.Context, req resource.UpdateRequest,
184175
// Generate API request body from plan
185176
var folder = api.Folder{
186177
Name: plan.Name.ValueString(),
187-
Personal: plan.Personal.ValueBool(),
188178
FolderParentID: plan.FolderParentId.ValueString(),
189179
}
190180

@@ -215,7 +205,6 @@ func (r *folderResource) Update(ctx context.Context, req resource.UpdateRequest,
215205
// Map response body to schema and populate Computed attribute values
216206
plan.ID = types.StringValue(cFolder.ID)
217207
plan.Name = types.StringValue(cFolder.Name)
218-
plan.Personal = types.BoolValue(cFolder.Personal)
219208
// This uses folder instead of cFolder since cFolder may contain the previous parent ID if a move operation was performed.
220209
plan.FolderParentId = types.StringValue(folder.FolderParentID)
221210

0 commit comments

Comments
 (0)