Skip to content

Commit

Permalink
Add auto-delete boot disk as an option on vm-instance
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-stroud committed Sep 13, 2022
1 parent 02cbdbf commit 93a703a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/compute/vm-instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_auto_delete_boot_disk"></a> [auto\_delete\_boot\_disk](#input\_auto\_delete\_boot\_disk) | Controlls if boot disk should be auto-deleted when instance is deleted. | `bool` | `true` | no |
| <a name="input_bandwidth_tier"></a> [bandwidth\_tier](#input\_bandwidth\_tier) | Tier 1 bandwidth increases the maximum egress bandwidth for VMs.<br> Using the `tier_1_enabled` setting will enable both gVNIC and TIER\_1 higher bandwidth networking.<br> Using the `gvnic_enabled` setting will only enable gVNIC and will not enable TIER\_1.<br> Note that TIER\_1 only works with specific machine families & shapes and must be using an image that supports gVNIC. See [official docs](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration) for more details. | `string` | `"not_enabled"` | no |
| <a name="input_deployment_name"></a> [deployment\_name](#input\_deployment\_name) | Name of the deployment, used to name the cluster | `string` | n/a | yes |
| <a name="input_disable_public_ips"></a> [disable\_public\_ips](#input\_disable\_public\_ips) | If set to true, instances will not have public IPs | `bool` | `false` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/compute/vm-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ resource "google_compute_instance" "compute_vm" {
boot_disk {
source = google_compute_disk.boot_disk[count.index].self_link
device_name = google_compute_disk.boot_disk[count.index].name
auto_delete = true
auto_delete = var.auto_delete_boot_disk
}

dynamic "scratch_disk" {
Expand Down
6 changes: 6 additions & 0 deletions modules/compute/vm-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ variable "disk_type" {
default = "pd-standard"
}

variable "auto_delete_boot_disk" {
description = "Controlls if boot disk should be auto-deleted when instance is deleted."
type = bool
default = true
}

variable "local_ssd_count" {
description = "The number of local SSDs to attach to each VM. See https://cloud.google.com/compute/docs/disks/local-ssd."
type = number
Expand Down

0 comments on commit 93a703a

Please sign in to comment.