Files
hunfabric/tests/modules/compute_vm/examples/disks-example-template.yaml
Suryansh Singhal ba304518f1 Prevent recreation for key_revocation_action in compute-vm module (#3620)
* fix(compute-vm): prevent instance recreation for key_revocation_action_type

The `key_revocation_action_type` attribute in the `google_compute_instance`
resource defaults to `NONE` on the provider side.

When this optional attribute was not explicitly set in the module's
`options` variable, it resolved to `null` in the Terraform configuration.
This caused Terraform to detect a change from `null` to `NONE` on every
plan, leading to unnecessary instance recreation.

This change applies `coalesce` to
`var.options.key_revocation_action_type` in the resource definition so
that it defaults to `NONE` when unset, aligning the configuration with
provider behavior and preventing a permadiff.

* updated the regional compute template too with the key_revocation_action_type

* fixed the formatting
2026-01-05 11:53:47 +01:00

118 lines
3.9 KiB
YAML

# 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-disks-example.google_compute_instance_template.default[0]:
advanced_machine_features: []
can_ip_forward: false
description: Managed by the compute-vm Terraform module.
disk:
- auto_delete: true
boot: true
disk_encryption_key: []
disk_name: null
disk_size_gb: 10
disk_type: pd-balanced
guest_os_features: null
labels: null
resource_manager_tags: null
resource_policies: null
source: null
source_image: projects/debian-cloud/global/images/family/debian-11
source_image_encryption_key: []
source_snapshot: null
source_snapshot_encryption_key: []
- auto_delete: false
device_name: repd
disk_encryption_key: []
disk_name: null
guest_os_features: null
labels: null
mode: READ_WRITE
resource_manager_tags: null
resource_policies: null
source: https://www.googleapis.com/compute/v1/projects/project-id/regions/europe-west8/disks/repd-test-1
source_image_encryption_key: []
source_snapshot: null
source_snapshot_encryption_key: []
type: PERSISTENT
effective_labels:
goog-terraform-provisioned: "true"
enable_display: null
guest_accelerator: []
instance_description: null
key_revocation_action_type: NONE
labels: null
machine_type: f1-micro
metadata: null
metadata_startup_script: null
min_cpu_platform: null
name_prefix: test-
network_interface:
- access_config: []
alias_ip_range: []
ipv6_access_config: []
network: https://www.googleapis.com/compute/v1/projects/xxx/global/networks/aaa
network_ip: null
nic_type: null
queue_count: null
subnetwork: subnet_self_link
network_performance_config: []
partner_metadata: null
project: project-id
region: europe-west8
reservation_affinity: []
resource_manager_tags: null
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
termination_time: null
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: []
tags: null
terraform_labels:
goog-terraform-provisioned: "true"
timeouts: null
module.vm-disks-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
counts:
google_compute_instance_template: 1
google_service_account: 1
outputs: {}