Skip to content

Commit

Permalink
visible_core_count added to GA for google_compute_instance (#6824) (#…
Browse files Browse the repository at this point in the history
…13043)

* visible core counts added to GA

* visible core counts changed from 1 to 2

* visible_core_count changed to 1

Signed-off-by: Modular Magician <magic-modules@google.com>

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Nov 15, 2022
1 parent 1136b94 commit 2e9355a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/6824.txt
@@ -0,0 +1,3 @@
```release-note:enhancement
compute: promoted `visible_core_count` field of `google_compute_instance` to GA
```
2 changes: 2 additions & 0 deletions google/compute_instance_helpers.go
Expand Up @@ -396,6 +396,7 @@ func expandAdvancedMachineFeatures(d TerraformResourceData) *compute.AdvancedMac
return &compute.AdvancedMachineFeatures{
EnableNestedVirtualization: d.Get(prefix + ".enable_nested_virtualization").(bool),
ThreadsPerCore: int64(d.Get(prefix + ".threads_per_core").(int)),
VisibleCoreCount: int64(d.Get(prefix + ".visible_core_count").(int)),
}
}

Expand All @@ -406,6 +407,7 @@ func flattenAdvancedMachineFeatures(AdvancedMachineFeatures *compute.AdvancedMac
return []map[string]interface{}{{
"enable_nested_virtualization": AdvancedMachineFeatures.EnableNestedVirtualization,
"threads_per_core": AdvancedMachineFeatures.ThreadsPerCore,
"visible_core_count": AdvancedMachineFeatures.VisibleCoreCount,
}}
}

Expand Down
6 changes: 6 additions & 0 deletions google/resource_compute_instance.go
Expand Up @@ -726,6 +726,12 @@ func resourceComputeInstance() *schema.Resource {
AtLeastOneOf: []string{"advanced_machine_features.0.enable_nested_virtualization", "advanced_machine_features.0.threads_per_core"},
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,
AtLeastOneOf: []string{"advanced_machine_features.0.enable_nested_virtualization", "advanced_machine_features.0.threads_per_core", "advanced_machine_features.0.visible_core_count"},
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.`,
},
},
},
},
Expand Down
1 change: 1 addition & 0 deletions google/resource_compute_instance_test.go
Expand Up @@ -4696,6 +4696,7 @@ resource "google_compute_instance" "foobar" {
advanced_machine_features {
threads_per_core = 1
enable_nested_virtualization = true
visible_core_count = 1
}
allow_stopping_for_update = true
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/compute_instance.html.markdown
Expand Up @@ -421,7 +421,7 @@ specified, then this instance will have no external IPv6 Internet access. Struct

* `threads_per_core` (Optional) he number of threads per physical core. To disable [simultaneous multithreading (SMT)](https://cloud.google.com/compute/docs/instances/disabling-smt) set this to 1.

* `visible_core_count` (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The number of physical cores to expose to an instance. [visible cores info (VC)](https://cloud.google.com/compute/docs/instances/customize-visible-cores).
* `visible_core_count` (Optional) The number of physical cores to expose to an instance. [visible cores info (VC)](https://cloud.google.com/compute/docs/instances/customize-visible-cores).

<a name="nested_reservation_affinity"></a>The `reservation_affinity` block supports:

Expand Down

0 comments on commit 2e9355a

Please sign in to comment.