Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visible_core_count added to GA for google_compute_instance #13043

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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