diff --git a/.changelog/6860.txt b/.changelog/6860.txt new file mode 100644 index 00000000000..63c77a1a00f --- /dev/null +++ b/.changelog/6860.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: fixed a crash with `google_compute_instance_template` on a newly released field when `advanced_machine_features` was set +``` diff --git a/google/resource_compute_instance_template.go b/google/resource_compute_instance_template.go index cf6bf6825ee..1f591b075ab 100644 --- a/google/resource_compute_instance_template.go +++ b/google/resource_compute_instance_template.go @@ -642,6 +642,12 @@ func resourceComputeInstanceTemplate() *schema.Resource { ForceNew: true, Description: `The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed.`, }, + "visible_core_count": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: `The number of physical cores to expose to an instance. Multiply by the number of threads per core to compute the total number of virtual CPUs to expose to the instance. If unset, the number of cores is inferred from the instance\'s nominal CPU count and the underlying platform\'s SMT width.`, + }, }, }, }, diff --git a/google/resource_compute_instance_template_test.go b/google/resource_compute_instance_template_test.go index 4701da9f155..e8ad7261d66 100644 --- a/google/resource_compute_instance_template_test.go +++ b/google/resource_compute_instance_template_test.go @@ -2507,6 +2507,7 @@ resource "google_compute_instance_template" "foobar" { advanced_machine_features { threads_per_core = 1 enable_nested_virtualization = true + visible_core_count = 1 } scheduling {