Skip to content

Commit

Permalink
FileSystem FullPath Attribute
Browse files Browse the repository at this point in the history
- Add a parameter called `full_path` which includes the full path of the
  filesystem including the inital `/`. This initial `/` is removed from
  the ID for easie of use with the APIs but the full path can be useful
  by the terraform consumer.
  • Loading branch information
doriac11 committed Sep 15, 2023
1 parent a397fa6 commit 2c9f91e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/resources/filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ After the execution of above resource block, a powerscale_filesystem would have
'public_read', 'public_read_write', 'public' or permissions in POSIX format as '0550', '0770', '0775','0777' or 0700. The Default value is (0700).
(Update Supported but Modification of ACL is only supported from POSIX to POSIX mode)
- `directory_path` (String) FileSystem directory path.This specifies the path to the FileSystem(Namespace directory) which we are trying to manage. If no directory path is specified, [/ifs] would be taken by default.
- `full_path` (String) The full path of the FileSystem
- `id` (String) FileSystem identifier. Unique identifier for the FileSystem(Namespace directory)
- `overwrite` (Boolean) Deletes and replaces the existing user attributes and ACLs of the directory with user-specified attributes if set to true.
- `query_zone` (String) Specifies the zone that the object belongs to. Optional and will default to the default access zone if one is not set.
Expand Down
1 change: 1 addition & 0 deletions powerscale/helper/file_system_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ func UpdateFileSystemResourceState(ctx context.Context, plan *models.FileSystemR
// UpdateFileSystemResourcePlanData Updates File System Resource State from plan data.
func UpdateFileSystemResourcePlanData(plan *models.FileSystemResource, state *models.FileSystemResource) {
state.ID = types.StringValue(GetDirectoryPath(plan.DirectoryPath.ValueString(), plan.Name.ValueString()))
state.FullPath = types.StringValue("/" + state.ID.ValueString())
state.Name = plan.Name
state.DirectoryPath = plan.DirectoryPath
state.Overwrite = plan.Overwrite
Expand Down
1 change: 1 addition & 0 deletions powerscale/models/file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ type FileSystemFilterType struct {
// FileSystemResource Defines the File System Resource Model.
type FileSystemResource struct {
ID types.String `tfsdk:"id"`
FullPath types.String `tfsdk:"full_path"`
Name types.String `tfsdk:"name"`
DirectoryPath types.String `tfsdk:"directory_path"`
Owner MemberObject `tfsdk:"owner"`
Expand Down
6 changes: 6 additions & 0 deletions powerscale/provider/file_system_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ func (r *FileSystemResource) Schema(ctx context.Context, req resource.SchemaRequ
MarkdownDescription: "FileSystem directory name",
Required: true,
},
"full_path": schema.StringAttribute{
Description: "The full path of the FileSystem",
MarkdownDescription: "The full path of the FileSystem",
Computed: true,
Optional: true,
},
"directory_path": schema.StringAttribute{
Description: "FileSystem directory path.This specifies the path to the FileSystem(Namespace directory) which we are trying to manage. If no directory path is specified, [/ifs] would be taken by default.",
MarkdownDescription: "FileSystem directory path.This specifies the path to the FileSystem(Namespace directory) which we are trying to manage. If no directory path is specified, [/ifs] would be taken by default.",
Expand Down

0 comments on commit 2c9f91e

Please sign in to comment.