Skip to content

Commit

Permalink
Merge pull request #2863 from tpdownes/localssd_posix_perms
Browse files Browse the repository at this point in the history
Enable local SSD formatting solution to set POSIX permissions
  • Loading branch information
tpdownes authored Aug 2, 2024
2 parents 62ad190 + 7e35995 commit 1d7dc33
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/scripts/startup-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ No modules.
| <a name="input_install_docker"></a> [install\_docker](#input\_install\_docker) | Install Docker command line tool and daemon. | `bool` | `false` | no |
| <a name="input_install_stackdriver_agent"></a> [install\_stackdriver\_agent](#input\_install\_stackdriver\_agent) | Run Google Stackdriver Agent installation script if set to true. Preferred over ops agent for performance. | `bool` | `false` | no |
| <a name="input_labels"></a> [labels](#input\_labels) | Labels for the created GCS bucket. Key-value pairs. | `map(string)` | n/a | yes |
| <a name="input_local_ssd_filesystem"></a> [local\_ssd\_filesystem](#input\_local\_ssd\_filesystem) | Create and mount a filesystem from local SSD disks (data will be lost if VMs are powered down without enabling migration); enable by setting mountpoint field to a valid directory path. | <pre>object({<br> fs_type = optional(string, "ext4")<br> mountpoint = optional(string, "")<br> })</pre> | <pre>{<br> "fs_type": "ext4",<br> "mountpoint": ""<br>}</pre> | no |
| <a name="input_local_ssd_filesystem"></a> [local\_ssd\_filesystem](#input\_local\_ssd\_filesystem) | Create and mount a filesystem from local SSD disks (data will be lost if VMs are powered down without enabling migration); enable by setting mountpoint field to a valid directory path. | <pre>object({<br> fs_type = optional(string, "ext4")<br> mountpoint = optional(string, "")<br> permissions = optional(string, "0755")<br> })</pre> | <pre>{<br> "fs_type": "ext4",<br> "mountpoint": "",<br> "permissions": "0755"<br>}</pre> | no |
| <a name="input_prepend_ansible_installer"></a> [prepend\_ansible\_installer](#input\_prepend\_ansible\_installer) | DEPRECATED. Use `install_ansible=false` to prevent ansible installation. | `bool` | `null` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | The region to deploy to | `string` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions modules/scripts/startup-script/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ locals {
args = join(" ", [
"-e mountpoint=${var.local_ssd_filesystem.mountpoint}",
"-e fs_type=${var.local_ssd_filesystem.fs_type}",
"-e mode=${var.local_ssd_filesystem.permissions}",
])
},
]
Expand Down
15 changes: 11 additions & 4 deletions modules/scripts/startup-script/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ variable "install_docker" {
variable "local_ssd_filesystem" {
description = "Create and mount a filesystem from local SSD disks (data will be lost if VMs are powered down without enabling migration); enable by setting mountpoint field to a valid directory path."
type = object({
fs_type = optional(string, "ext4")
mountpoint = optional(string, "")
fs_type = optional(string, "ext4")
mountpoint = optional(string, "")
permissions = optional(string, "0755")
})

validation {
Expand All @@ -143,9 +144,15 @@ variable "local_ssd_filesystem" {
error_message = "To enable local SSD filesystems, var.local_ssd_filesystem.mountpoint must be set to an absolute path to a mountpoint."
}

validation {
condition = length(regexall("^[0-7]{3,4}$", var.local_ssd_filesystem.permissions)) > 0
error_message = "The POSIX permissions for the mountpoint must be represented as a 3 or 4-digit octal"
}

default = {
fs_type = "ext4"
mountpoint = ""
fs_type = "ext4"
mountpoint = ""
permissions = "0755"
}

nullable = false
Expand Down

0 comments on commit 1d7dc33

Please sign in to comment.