From 6567d63d92d095a26c61878c06f73384fa050050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Niesiob=C4=99dzki?= Date: Thu, 6 Nov 2025 20:59:05 +0000 Subject: [PATCH] Add support for hyperdisk performance options --- modules/compute-vm/README.md | 200 ++++++++++++--- modules/compute-vm/main.tf | 39 +-- modules/compute-vm/resource-policies.tf | 2 +- modules/compute-vm/template.tf | 36 +-- modules/compute-vm/variables.tf | 26 +- .../disk-hyperdisk-cust-performance.yaml | 192 +++++++++++++++ .../examples/disk-hyperdisk-pool.yaml | 229 ++++++++++++++++++ 7 files changed, 648 insertions(+), 76 deletions(-) create mode 100644 tests/modules/compute_vm/examples/disk-hyperdisk-cust-performance.yaml create mode 100644 tests/modules/compute_vm/examples/disk-hyperdisk-pool.yaml diff --git a/modules/compute-vm/README.md b/modules/compute-vm/README.md index b2f627fe5..982f79676 100644 --- a/modules/compute-vm/README.md +++ b/modules/compute-vm/README.md @@ -234,7 +234,6 @@ module "vm-disk-options-example" { source_type = "image" source = "image-1" options = { - auto_delete = false replica_zone = "${var.region}-c" } }, @@ -256,6 +255,135 @@ module "vm-disk-options-example" { # tftest inventory=disk-options.yaml ``` +For hyperdisks there are additional options available to configure performance. + +```hcl +module "vm-disk-options-example" { + source = "./fabric/modules/compute-vm" + project_id = var.project_id + zone = "${var.region}-b" + name = "test" + instance_type = "n4-standard-2" + network_interfaces = [{ + network = var.vpc.self_link + subnetwork = var.subnet.self_link + }] + boot_disk = { + initialize_params = { + image = "projects/debian-cloud/global/images/family/debian-12" + provisioned_iops = 3000 + provisioned_throughput = 140 + type = "hyperdisk-balanced" + } + } + + attached_disks = [ + { + #projects/debian-cloud/global/images/family/debian-12 + name = "data1" + size = "10" + options = { + provisioned_iops = 3000 + provisioned_throughput = 140 + type = "hyperdisk-balanced" + } + }, + { + name = "data2" + size = "10" + source_type = "image" + source = "projects/debian-cloud/global/images/family/debian-12" + options = { + provisioned_iops = 5000 + provisioned_throughput = 500 + type = "hyperdisk-balanced" + } + }, + + ] + service_account = { + auto_create = true + } + shielded_config = {} +} + +# tftest inventory=disk-hyperdisk-cust-performance.yaml e2e +``` + +You can use storage pool for better management of storage capacity. + +```hcl +# hyperdisk - with storage pool +resource "google_compute_storage_pool" "default" { + project = var.project_id + name = "storage-pool-basic" + + pool_provisioned_capacity_gb = "20480" + pool_provisioned_iops = "10000" + pool_provisioned_throughput = 1024 + storage_pool_type = "hyperdisk-balanced" + zone = "${var.region}-b" + + deletion_protection = false +} + +module "vm-disk-options-example" { + source = "./fabric/modules/compute-vm" + project_id = var.project_id + zone = "${var.region}-b" + name = "test" + instance_type = "c4d-standard-2" + network_interfaces = [ + { + network = var.vpc.self_link + subnetwork = var.subnet.self_link + } + ] + boot_disk = { + use_independent_disk = true + initialize_params = { + image = "projects/debian-cloud/global/images/family/debian-12" + provisioned_iops = 3000 + provisioned_throughput = 140 + storage_pool = google_compute_storage_pool.default.id + type = "hyperdisk-balanced" + } + } + + attached_disks = [ + { + #projects/debian-cloud/global/images/family/debian-12 + name = "data1" + size = "10" + options = { + # provisioned_iops = 3000 + # provisioned_throughput = 140 + storage_pool = google_compute_storage_pool.default.id + type = "hyperdisk-balanced" + } + }, + { + name = "data2" + size = "10" + source_type = "image" + source = "projects/debian-cloud/global/images/family/debian-12" + options = { + provisioned_iops = 5000 + provisioned_throughput = 500 + type = "hyperdisk-balanced" + } + }, + + ] + service_account = { + auto_create = true + } + shielded_config = {} +} + +# tftest inventory=disk-hyperdisk-pool.yaml e2e +``` + #### Boot disk as an independent resource To create the boot disk as an independent resources instead of as part of the instance creation flow, set `boot_disk.use_independent_disk` to `true` and optionally configure `boot_disk.initialize_params`. @@ -937,42 +1065,42 @@ module "sole-tenancy" { | name | description | type | required | default | |---|---|:---:|:---:|:---:| -| [name](variables.tf#L283) | Instance name. | string | ✓ | | -| [network_interfaces](variables.tf#L295) | Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed. | list(object({…})) | ✓ | | -| [project_id](variables.tf#L380) | Project id. | string | ✓ | | -| [zone](variables.tf#L500) | Compute zone. | string | ✓ | | +| [name](variables.tf#L289) | Instance name. | string | ✓ | | +| [network_interfaces](variables.tf#L301) | Network interfaces configuration. Use self links for Shared VPC, set addresses to null if not needed. | list(object({…})) | ✓ | | +| [project_id](variables.tf#L386) | Project id. | string | ✓ | | +| [zone](variables.tf#L506) | Compute zone. | string | ✓ | | | [attached_disk_defaults](variables.tf#L17) | Defaults for attached disks options. | object({…}) | | {…} | -| [attached_disks](variables.tf#L37) | Additional disks, if options is null defaults will be used in its place. Source type is one of 'image' (zonal disks in vms and template), 'snapshot' (vm), 'existing', and null. | list(object({…})) | | [] | -| [boot_disk](variables.tf#L82) | Boot disk properties. Initialize params are ignored when source is set. | object({…}) | | {…} | -| [can_ip_forward](variables.tf#L113) | Enable IP forwarding. | bool | | false | -| [confidential_compute](variables.tf#L119) | Enable Confidential Compute for these instances. | bool | | false | -| [context](variables.tf#L125) | Context-specific interpolations. | object({…}) | | {} | -| [create_template](variables.tf#L142) | Create instance template instead of instances. Defaults to a global template. | object({…}) | | null | -| [description](variables.tf#L151) | Description of a Compute Instance. | string | | "Managed by the compute-vm Terraform module." | -| [enable_display](variables.tf#L157) | Enable virtual display on the instances. | bool | | false | -| [encryption](variables.tf#L163) | Encryption options. Only one of kms_key_self_link and disk_encryption_key_raw may be set. If needed, you can specify to encrypt or not the boot disk. | object({…}) | | null | -| [gpu](variables.tf#L173) | GPU information. Based on https://cloud.google.com/compute/docs/gpus. | object({…}) | | null | -| [group](variables.tf#L208) | Define this variable to create an instance group for instances. Disabled for template use. | object({…}) | | null | -| [hostname](variables.tf#L216) | Instance FQDN name. | string | | null | -| [iam](variables.tf#L222) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) | | {} | -| [instance_schedule](variables.tf#L228) | Assign or create and assign an instance schedule policy. Either resource policy id or create_config must be specified if not null. Set active to null to dtach a policy from vm before destroying. | object({…}) | | null | -| [instance_type](variables.tf#L252) | Instance type. | string | | "f1-micro" | -| [labels](variables.tf#L258) | Instance labels. | map(string) | | {} | -| [metadata](variables.tf#L264) | Instance metadata. | map(string) | | {} | -| [metadata_startup_script](variables.tf#L270) | Instance startup script. Will trigger recreation on change, even after importing. | string | | null | -| [min_cpu_platform](variables.tf#L277) | Minimum CPU platform. | string | | null | -| [network_attached_interfaces](variables.tf#L288) | Network interfaces using network attachments. | list(string) | | [] | -| [network_tag_bindings](variables.tf#L316) | Resource manager tag bindings in arbitrary key => tag key or value id format. Set on both the instance only for networking purposes, and modifiable without impacting the main resource lifecycle. | map(string) | | {} | -| [options](variables.tf#L323) | Instance options. | object({…}) | | {…} | -| [project_number](variables.tf#L385) | Project number. Used in tag bindings to avoid a permadiff. | string | | null | -| [resource_policies](variables.tf#L391) | Resource policies to attach to the instance or template. | list(string) | | null | -| [scratch_disks](variables.tf#L398) | Scratch disks configuration. | object({…}) | | {…} | -| [service_account](variables.tf#L410) | Service account email and scopes. If email is null, the default Compute service account will be used unless auto_create is true, in which case a service account will be created. Set the variable to null to avoid attaching a service account. | object({…}) | | {} | -| [shielded_config](variables.tf#L420) | Shielded VM configuration of the instances. | object({…}) | | null | -| [snapshot_schedules](variables.tf#L430) | Snapshot schedule resource policies that can be attached to disks. | map(object({…})) | | {} | -| [tag_bindings](variables.tf#L473) | Resource manager tag bindings in arbitrary key => tag key or value id format. Set on both the instance and zonal disks, and modifiable without impacting the main resource lifecycle. | map(string) | | {} | -| [tag_bindings_immutable](variables.tf#L480) | Immutable resource manager tag bindings, in tagKeys/id => tagValues/id format. These are set on the instance or instance template at creation time, and trigger recreation if changed. | map(string) | | null | -| [tags](variables.tf#L494) | Instance network tags for firewall rule targets. | list(string) | | [] | +| [attached_disks](variables.tf#L37) | Additional disks, if options is null defaults will be used in its place. Source type is one of 'image' (zonal disks in vms and template), 'snapshot' (vm), 'existing', and null. | list(object({…})) | | [] | +| [boot_disk](variables.tf#L85) | Boot disk properties. Initialize params are ignored when source is set. | object({…}) | | {…} | +| [can_ip_forward](variables.tf#L119) | Enable IP forwarding. | bool | | false | +| [confidential_compute](variables.tf#L125) | Enable Confidential Compute for these instances. | bool | | false | +| [context](variables.tf#L131) | Context-specific interpolations. | object({…}) | | {} | +| [create_template](variables.tf#L148) | Create instance template instead of instances. Defaults to a global template. | object({…}) | | null | +| [description](variables.tf#L157) | Description of a Compute Instance. | string | | "Managed by the compute-vm Terraform module." | +| [enable_display](variables.tf#L163) | Enable virtual display on the instances. | bool | | false | +| [encryption](variables.tf#L169) | Encryption options. Only one of kms_key_self_link and disk_encryption_key_raw may be set. If needed, you can specify to encrypt or not the boot disk. | object({…}) | | null | +| [gpu](variables.tf#L179) | GPU information. Based on https://cloud.google.com/compute/docs/gpus. | object({…}) | | null | +| [group](variables.tf#L214) | Define this variable to create an instance group for instances. Disabled for template use. | object({…}) | | null | +| [hostname](variables.tf#L222) | Instance FQDN name. | string | | null | +| [iam](variables.tf#L228) | IAM bindings in {ROLE => [MEMBERS]} format. | map(list(string)) | | {} | +| [instance_schedule](variables.tf#L234) | Assign or create and assign an instance schedule policy. Either resource policy id or create_config must be specified if not null. Set active to null to dtach a policy from vm before destroying. | object({…}) | | null | +| [instance_type](variables.tf#L258) | Instance type. | string | | "f1-micro" | +| [labels](variables.tf#L264) | Instance labels. | map(string) | | {} | +| [metadata](variables.tf#L270) | Instance metadata. | map(string) | | {} | +| [metadata_startup_script](variables.tf#L276) | Instance startup script. Will trigger recreation on change, even after importing. | string | | null | +| [min_cpu_platform](variables.tf#L283) | Minimum CPU platform. | string | | null | +| [network_attached_interfaces](variables.tf#L294) | Network interfaces using network attachments. | list(string) | | [] | +| [network_tag_bindings](variables.tf#L322) | Resource manager tag bindings in arbitrary key => tag key or value id format. Set on both the instance only for networking purposes, and modifiable without impacting the main resource lifecycle. | map(string) | | {} | +| [options](variables.tf#L329) | Instance options. | object({…}) | | {…} | +| [project_number](variables.tf#L391) | Project number. Used in tag bindings to avoid a permadiff. | string | | null | +| [resource_policies](variables.tf#L397) | Resource policies to attach to the instance or template. | list(string) | | null | +| [scratch_disks](variables.tf#L404) | Scratch disks configuration. | object({…}) | | {…} | +| [service_account](variables.tf#L416) | Service account email and scopes. If email is null, the default Compute service account will be used unless auto_create is true, in which case a service account will be created. Set the variable to null to avoid attaching a service account. | object({…}) | | {} | +| [shielded_config](variables.tf#L426) | Shielded VM configuration of the instances. | object({…}) | | null | +| [snapshot_schedules](variables.tf#L436) | Snapshot schedule resource policies that can be attached to disks. | map(object({…})) | | {} | +| [tag_bindings](variables.tf#L479) | Resource manager tag bindings in arbitrary key => tag key or value id format. Set on both the instance and zonal disks, and modifiable without impacting the main resource lifecycle. | map(string) | | {} | +| [tag_bindings_immutable](variables.tf#L486) | Immutable resource manager tag bindings, in tagKeys/id => tagValues/id format. These are set on the instance or instance template at creation time, and trigger recreation if changed. | map(string) | | null | +| [tags](variables.tf#L500) | Instance network tags for firewall rule targets. | list(string) | | [] | ## Outputs diff --git a/modules/compute-vm/main.tf b/modules/compute-vm/main.tf index 4535cce8f..c44eb5060 100644 --- a/modules/compute-vm/main.tf +++ b/modules/compute-vm/main.tf @@ -82,10 +82,13 @@ resource "google_compute_disk" "boot" { zone = local.zone # by default, GCP creates boot disks with the same name as instance, the deviation here is kept for backwards # compatibility - name = "${var.name}-boot" - type = var.boot_disk.initialize_params.type - size = var.boot_disk.initialize_params.size - image = var.boot_disk.initialize_params.image + name = "${var.name}-boot" + type = var.boot_disk.initialize_params.type + size = var.boot_disk.initialize_params.size + image = var.boot_disk.initialize_params.image + provisioned_iops = var.boot_disk.initialize_params.provisioned_iops + provisioned_throughput = var.boot_disk.initialize_params.provisioned_throughput + storage_pool = var.boot_disk.initialize_params.storage_pool labels = merge(var.labels, { disk_name = "boot" disk_type = var.boot_disk.initialize_params.type @@ -108,13 +111,16 @@ resource "google_compute_disk" "disks" { for k, v in local.attached_disks_zonal : k => v if v.source_type != "attach" } - project = local.project_id - zone = local.zone - name = "${var.name}-${each.key}" - type = each.value.options.type - size = each.value.size - image = each.value.source_type == "image" ? each.value.source : null - snapshot = each.value.source_type == "snapshot" ? each.value.source : null + project = local.project_id + zone = local.zone + name = "${var.name}-${each.key}" + type = each.value.options.type + size = each.value.size + image = each.value.source_type == "image" ? each.value.source : null + provisioned_iops = each.value.options.provisioned_iops + provisioned_throughput = each.value.options.provisioned_throughput + snapshot = each.value.source_type == "snapshot" ? each.value.source : null + storage_pool = each.value.options.storage_pool labels = merge(var.labels, { disk_name = each.value.name disk_type = each.value.options.type @@ -278,10 +284,13 @@ resource "google_compute_instance" "default" { : [""] ) content { - image = var.boot_disk.initialize_params.image - size = var.boot_disk.initialize_params.size - type = var.boot_disk.initialize_params.type - resource_manager_tags = var.tag_bindings_immutable + image = var.boot_disk.initialize_params.image + size = var.boot_disk.initialize_params.size + type = var.boot_disk.initialize_params.type + resource_manager_tags = var.tag_bindings_immutable + provisioned_iops = var.boot_disk.initialize_params.provisioned_iops + provisioned_throughput = var.boot_disk.initialize_params.provisioned_throughput + storage_pool = var.boot_disk.initialize_params.storage_pool } } } diff --git a/modules/compute-vm/resource-policies.tf b/modules/compute-vm/resource-policies.tf index e717ecd74..ba6774088 100644 --- a/modules/compute-vm/resource-policies.tf +++ b/modules/compute-vm/resource-policies.tf @@ -21,7 +21,7 @@ locals { google_compute_resource_policy.schedule[0].id ] disk_zonal_schedule_attachments = flatten([ - for disk_key, disk_data in try(local.attached_disks_zonal, []) : + for disk_key, disk_data in local.attached_disks_zonal : disk_data.snapshot_schedule != null ? [ for schedule in disk_data.snapshot_schedule : { disk_key = disk_key diff --git a/modules/compute-vm/template.tf b/modules/compute-vm/template.tf index 4001d3e65..735e5c352 100644 --- a/modules/compute-vm/template.tf +++ b/modules/compute-vm/template.tf @@ -57,12 +57,14 @@ resource "google_compute_instance_template" "default" { } disk { - auto_delete = var.boot_disk.auto_delete - boot = true - disk_size_gb = var.boot_disk.initialize_params.size - disk_type = var.boot_disk.initialize_params.type - resource_manager_tags = var.tag_bindings_immutable - source_image = var.boot_disk.initialize_params.image + auto_delete = var.boot_disk.auto_delete + boot = true + disk_size_gb = var.boot_disk.initialize_params.size + disk_type = var.boot_disk.initialize_params.type + provisioned_iops = var.boot_disk.initialize_params.provisioned_iops + provisioned_throughput = var.boot_disk.initialize_params.provisioned_throughput + resource_manager_tags = var.tag_bindings_immutable + source_image = var.boot_disk.initialize_params.image dynamic "disk_encryption_key" { for_each = var.encryption != null ? [""] : [] @@ -106,7 +108,9 @@ resource "google_compute_instance_template" "default" { disk_size_gb = ( config.value.source_type != "attach" ? config.value.size : null ) - mode = config.value.options.mode + mode = config.value.options.mode + provisioned_iops = config.value.options.provisioned_iops + provisioned_throughput = config.value.options.provisioned_throughput source_image = ( config.value.source_type == "image" ? config.value.source : null ) @@ -276,12 +280,14 @@ resource "google_compute_region_instance_template" "default" { } disk { - auto_delete = var.boot_disk.auto_delete - boot = true - disk_size_gb = var.boot_disk.initialize_params.size - disk_type = var.boot_disk.initialize_params.type - resource_manager_tags = var.tag_bindings_immutable - source_image = var.boot_disk.initialize_params.image + auto_delete = var.boot_disk.auto_delete + boot = true + disk_size_gb = var.boot_disk.initialize_params.size + disk_type = var.boot_disk.initialize_params.type + provisioned_iops = var.boot_disk.initialize_params.provisioned_iops + provisioned_throughput = var.boot_disk.initialize_params.provisioned_throughput + resource_manager_tags = var.tag_bindings_immutable + source_image = var.boot_disk.initialize_params.image dynamic "disk_encryption_key" { for_each = var.encryption != null ? [""] : [] @@ -324,7 +330,9 @@ resource "google_compute_region_instance_template" "default" { disk_size_gb = ( config.value.source_type != "attach" ? config.value.size : null ) - mode = config.value.options.mode + mode = config.value.options.mode + provisioned_iops = config.value.options.provisioned_iops + provisioned_throughput = config.value.options.provisioned_throughput source_image = ( config.value.source_type == "image" ? config.value.source : null ) diff --git a/modules/compute-vm/variables.tf b/modules/compute-vm/variables.tf index 6e6dfa9c9..ac2caf9aa 100644 --- a/modules/compute-vm/variables.tf +++ b/modules/compute-vm/variables.tf @@ -46,10 +46,13 @@ variable "attached_disks" { source_type = optional(string) options = optional( object({ - auto_delete = optional(bool, false) - mode = optional(string, "READ_WRITE") - replica_zone = optional(string) - type = optional(string, "pd-balanced") + auto_delete = optional(bool, false) # applies only to vm templates + mode = optional(string, "READ_WRITE") + provisioned_iops = optional(number) + provisioned_throughput = optional(number) # in MiB/s + replica_zone = optional(string) + storage_pool = optional(string) + type = optional(string, "pd-balanced") }), { auto_delete = true @@ -86,9 +89,12 @@ variable "boot_disk" { snapshot_schedule = optional(list(string)) source = optional(string) initialize_params = optional(object({ - image = optional(string, "projects/debian-cloud/global/images/family/debian-11") - size = optional(number, 10) - type = optional(string, "pd-balanced") + image = optional(string, "projects/debian-cloud/global/images/family/debian-11") + provisioned_iops = optional(number) + provisioned_throughput = optional(number) # in MiB/s + size = optional(number, 10) + storage_pool = optional(string) + type = optional(string, "pd-balanced") }), {}) use_independent_disk = optional(bool, false) }) @@ -420,9 +426,9 @@ variable "service_account" { variable "shielded_config" { description = "Shielded VM configuration of the instances." type = object({ - enable_secure_boot = bool - enable_vtpm = bool - enable_integrity_monitoring = bool + enable_secure_boot = optional(bool, true) + enable_vtpm = optional(bool, true) + enable_integrity_monitoring = optional(bool, true) }) default = null } diff --git a/tests/modules/compute_vm/examples/disk-hyperdisk-cust-performance.yaml b/tests/modules/compute_vm/examples/disk-hyperdisk-cust-performance.yaml new file mode 100644 index 000000000..9d4d97302 --- /dev/null +++ b/tests/modules/compute_vm/examples/disk-hyperdisk-cust-performance.yaml @@ -0,0 +1,192 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +values: + module.vm-disk-options-example.google_compute_disk.disks["data1"]: + architecture: null + async_primary_disk: [] + create_snapshot_before_destroy: false + create_snapshot_before_destroy_prefix: null + description: null + disk_encryption_key: [] + effective_labels: + disk_name: data1 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + image: null + labels: + disk_name: data1 + disk_type: hyperdisk-balanced + name: test-data1 + params: [] + project: project-id + provisioned_iops: 3000 + provisioned_throughput: 140 + size: 10 + snapshot: null + source_disk: null + source_image_encryption_key: [] + source_instant_snapshot: null + source_snapshot_encryption_key: [] + source_storage_object: null + storage_pool: null + terraform_labels: + disk_name: data1 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + timeouts: null + type: hyperdisk-balanced + zone: europe-west8-b + module.vm-disk-options-example.google_compute_disk.disks["data2"]: + architecture: null + async_primary_disk: [] + create_snapshot_before_destroy: false + create_snapshot_before_destroy_prefix: null + description: null + disk_encryption_key: [] + effective_labels: + disk_name: data2 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + image: projects/debian-cloud/global/images/family/debian-12 + labels: + disk_name: data2 + disk_type: hyperdisk-balanced + name: test-data2 + params: [] + project: project-id + provisioned_iops: 5000 + provisioned_throughput: 500 + size: 10 + snapshot: null + source_disk: null + source_image_encryption_key: [] + source_instant_snapshot: null + source_snapshot_encryption_key: [] + source_storage_object: null + storage_pool: null + terraform_labels: + disk_name: data2 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + timeouts: null + type: hyperdisk-balanced + zone: europe-west8-b + module.vm-disk-options-example.google_compute_instance.default[0]: + advanced_machine_features: [] + allow_stopping_for_update: true + attached_disk: + - device_name: data1 + disk_encryption_key_raw: null + disk_encryption_key_rsa: null + disk_encryption_service_account: null + force_attach: null + mode: READ_WRITE + source: test-data1 + - device_name: data2 + disk_encryption_key_raw: null + disk_encryption_key_rsa: null + disk_encryption_service_account: null + force_attach: null + mode: READ_WRITE + source: test-data2 + boot_disk: + - auto_delete: true + disk_encryption_key_raw: null + disk_encryption_key_rsa: null + disk_encryption_service_account: null + force_attach: null + initialize_params: + - image: projects/debian-cloud/global/images/family/debian-12 + provisioned_iops: 3000 + provisioned_throughput: 140 + resource_manager_tags: null + size: 10 + source_image_encryption_key: [] + source_snapshot_encryption_key: [] + storage_pool: null + type: hyperdisk-balanced + interface: null + mode: READ_WRITE + can_ip_forward: false + deletion_protection: false + description: Managed by the compute-vm Terraform module. + desired_status: null + effective_labels: + goog-terraform-provisioned: 'true' + enable_display: false + hostname: null + instance_encryption_key: [] + key_revocation_action_type: null + labels: null + machine_type: n4-standard-2 + metadata: null + metadata_startup_script: null + name: test + network_interface: + - access_config: [] + alias_ip_range: [] + ipv6_access_config: [] + network: projects/xxx/global/networks/aaa + nic_type: null + queue_count: null + security_policy: null + subnetwork: subnet_self_link + network_performance_config: [] + params: [] + partner_metadata: null + project: project-id + resource_policies: null + scheduling: + - automatic_restart: true + availability_domain: null + graceful_shutdown: [] + host_error_timeout_seconds: null + instance_termination_action: null + local_ssd_recovery_timeout: [] + maintenance_interval: null + max_run_duration: [] + min_node_cpus: null + node_affinities: [] + on_host_maintenance: MIGRATE + on_instance_stop_action: [] + preemptible: false + provisioning_model: STANDARD + skip_guest_os_shutdown: false + termination_time: null + scratch_disk: [] + service_account: + - email: tf-vm-test@project-id.iam.gserviceaccount.com + scopes: + - https://www.googleapis.com/auth/cloud-platform + - https://www.googleapis.com/auth/userinfo.email + shielded_instance_config: + - enable_integrity_monitoring: true + enable_secure_boot: true + enable_vtpm: true + tags: null + terraform_labels: + goog-terraform-provisioned: 'true' + timeouts: null + zone: europe-west8-b + module.vm-disk-options-example.google_service_account.service_account[0]: + account_id: tf-vm-test + create_ignore_already_exists: null + description: null + disabled: false + display_name: Terraform VM test. + email: tf-vm-test@project-id.iam.gserviceaccount.com + member: serviceAccount:tf-vm-test@project-id.iam.gserviceaccount.com + project: project-id + timeouts: null diff --git a/tests/modules/compute_vm/examples/disk-hyperdisk-pool.yaml b/tests/modules/compute_vm/examples/disk-hyperdisk-pool.yaml new file mode 100644 index 000000000..45bc67d95 --- /dev/null +++ b/tests/modules/compute_vm/examples/disk-hyperdisk-pool.yaml @@ -0,0 +1,229 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +values: + google_compute_storage_pool.default: + deletion_protection: false + description: null + effective_labels: + goog-terraform-provisioned: 'true' + labels: null + name: storage-pool-basic + pool_provisioned_capacity_gb: '20480' + pool_provisioned_iops: '10000' + pool_provisioned_throughput: '1024' + project: project-id + storage_pool_type: hyperdisk-balanced + terraform_labels: + goog-terraform-provisioned: 'true' + timeouts: null + zone: europe-west8-b + module.vm-disk-options-example.google_compute_disk.boot[0]: + architecture: null + async_primary_disk: [] + create_snapshot_before_destroy: false + create_snapshot_before_destroy_prefix: null + description: null + disk_encryption_key: [] + effective_labels: + disk_name: boot + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + image: projects/debian-cloud/global/images/family/debian-12 + labels: + disk_name: boot + disk_type: hyperdisk-balanced + name: test-boot + params: [] + project: project-id + provisioned_iops: 3000 + provisioned_throughput: 140 + size: 10 + snapshot: null + source_disk: null + source_image_encryption_key: [] + source_instant_snapshot: null + source_snapshot_encryption_key: [] + source_storage_object: null + terraform_labels: + disk_name: boot + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + timeouts: null + type: hyperdisk-balanced + zone: europe-west8-b + module.vm-disk-options-example.google_compute_disk.disks["data1"]: + architecture: null + async_primary_disk: [] + create_snapshot_before_destroy: false + create_snapshot_before_destroy_prefix: null + description: null + disk_encryption_key: [] + effective_labels: + disk_name: data1 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + image: null + labels: + disk_name: data1 + disk_type: hyperdisk-balanced + name: test-data1 + params: [] + project: project-id + size: 10 + snapshot: null + source_disk: null + source_image_encryption_key: [] + source_instant_snapshot: null + source_snapshot_encryption_key: [] + source_storage_object: null + terraform_labels: + disk_name: data1 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + timeouts: null + type: hyperdisk-balanced + zone: europe-west8-b + module.vm-disk-options-example.google_compute_disk.disks["data2"]: + architecture: null + async_primary_disk: [] + create_snapshot_before_destroy: false + create_snapshot_before_destroy_prefix: null + description: null + disk_encryption_key: [] + effective_labels: + disk_name: data2 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + image: projects/debian-cloud/global/images/family/debian-12 + labels: + disk_name: data2 + disk_type: hyperdisk-balanced + name: test-data2 + params: [] + project: project-id + provisioned_iops: 5000 + provisioned_throughput: 500 + size: 10 + snapshot: null + source_disk: null + source_image_encryption_key: [] + source_instant_snapshot: null + source_snapshot_encryption_key: [] + source_storage_object: null + storage_pool: null + terraform_labels: + disk_name: data2 + disk_type: hyperdisk-balanced + goog-terraform-provisioned: 'true' + timeouts: null + type: hyperdisk-balanced + zone: europe-west8-b + module.vm-disk-options-example.google_compute_instance.default[0]: + advanced_machine_features: [] + allow_stopping_for_update: true + attached_disk: + - device_name: data1 + disk_encryption_key_raw: null + disk_encryption_key_rsa: null + disk_encryption_service_account: null + force_attach: null + mode: READ_WRITE + source: test-data1 + - device_name: data2 + disk_encryption_key_raw: null + disk_encryption_key_rsa: null + disk_encryption_service_account: null + force_attach: null + mode: READ_WRITE + source: test-data2 + boot_disk: + - auto_delete: false + disk_encryption_key_raw: null + disk_encryption_key_rsa: null + disk_encryption_service_account: null + force_attach: null + interface: null + mode: READ_WRITE + can_ip_forward: false + deletion_protection: false + description: Managed by the compute-vm Terraform module. + desired_status: null + effective_labels: + goog-terraform-provisioned: 'true' + enable_display: false + hostname: null + instance_encryption_key: [] + key_revocation_action_type: null + labels: null + machine_type: c4d-standard-2 + metadata: null + metadata_startup_script: null + name: test + network_interface: + - access_config: [] + alias_ip_range: [] + ipv6_access_config: [] + network: projects/xxx/global/networks/aaa + nic_type: null + queue_count: null + security_policy: null + subnetwork: subnet_self_link + network_performance_config: [] + params: [] + partner_metadata: null + project: project-id + resource_policies: null + scheduling: + - automatic_restart: true + availability_domain: null + graceful_shutdown: [] + host_error_timeout_seconds: null + instance_termination_action: null + local_ssd_recovery_timeout: [] + maintenance_interval: null + max_run_duration: [] + min_node_cpus: null + node_affinities: [] + on_host_maintenance: MIGRATE + on_instance_stop_action: [] + preemptible: false + provisioning_model: STANDARD + skip_guest_os_shutdown: false + termination_time: null + scratch_disk: [] + service_account: + - email: tf-vm-test@project-id.iam.gserviceaccount.com + scopes: + - https://www.googleapis.com/auth/cloud-platform + - https://www.googleapis.com/auth/userinfo.email + shielded_instance_config: + - enable_integrity_monitoring: true + enable_secure_boot: true + enable_vtpm: true + tags: null + terraform_labels: + goog-terraform-provisioned: 'true' + timeouts: null + zone: europe-west8-b + module.vm-disk-options-example.google_service_account.service_account[0]: + account_id: tf-vm-test + create_ignore_already_exists: null + description: null + disabled: false + display_name: Terraform VM test. + email: tf-vm-test@project-id.iam.gserviceaccount.com + member: serviceAccount:tf-vm-test@project-id.iam.gserviceaccount.com + project: project-id + timeouts: null