-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add advanced_machine_features
to GCE Instances
#4849
Add advanced_machine_features
to GCE Instances
#4849
Conversation
Co-authored-by: upodroid <cy@borg.dev>
Hello! I am a robot who works on Magic Modules PRs. I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review. Thanks for your contribution! A human will be with you soon. @c2thorn, please review this PR or find an appropriate assignee. |
According to the docs, the fields are updatable but it doesn't work. https://cloud.google.com/compute/docs/instances/nested-virtualization/enabling#enabling_nested_virtualization_directly
Do you want to wait for API support or shall I mark the fields as I'll update the Instance Template after this issue is fixed. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 186 insertions(+), 3 deletions(-)) |
I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=190963" |
I raised the Instance template as a separate PR. Templates can't be updated so it is easier to work with #4850 |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 185 insertions(+), 3 deletions(-)) |
I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=190966" |
mmv1/third_party/terraform/resources/resource_compute_instance.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me reach out to the API team, but in the meantime it shouldn't be a breaking change to label this block as ForceNew
, and then switch to an updatable version afterwards.
@@ -641,6 +641,29 @@ func resourceComputeInstance() *schema.Resource { | |||
}, | |||
}, | |||
}, | |||
"advanced_machine_features": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should utilize AtLeastOneOf
here to avoid an empty block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add AtLeastOneOf here, we should probably also add it to the template to keep them in sync with similar diff/recreate behavior.
#4850
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AtLeastOneOf might also resolve this issue: hashicorp/terraform-provider-google#9436
But it would make the block required for users to set, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intention with AtLeastOneOf is to apply it to enable_nested_virtualization
and threads_per_core
, so that if advanced_machine_features
is specified at all, one of those fields will be required.
mmv1/third_party/terraform/resources/resource_compute_instance.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown
Show resolved
Hide resolved
mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown
Show resolved
Hide resolved
mmv1/third_party/terraform/utils/compute_instance_helpers.go.erb
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/resources/resource_compute_instance.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/tests/resource_compute_instance_test.go
Outdated
Show resolved
Hide resolved
mmv1/third_party/terraform/tests/resource_compute_instance_test.go
Outdated
Show resolved
Hide resolved
It has been a while and docs have been unclear. I'll rebase this and test it again on Monday |
Type: schema.TypeInt, | ||
Optional: true, | ||
Computed: false, | ||
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.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description could probably be clearer.
Perhaps:
The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads per core supported by the underlying processor is used by default. The number of threads per core is not configurable on machine types that have fewer than 2 vCPUs.`,
It's unclear to me whether this field will be populated with the maximum number of threads per core supported by the underlying processor or not. I assume, since it's marked as not computed that the API never returns a value that wasn't specified by the user. Is this correct?
It's also unclear from the docs when exactly the API will error. Does it allow specifying 1
for a 1 vCPU machine type, like n1-standard-1, or is it actually unconfigurable and error if any value is specified in that case? We might need to change "not configurable" to "must be 1
or unspecified".
After some testing, I don't think the API actually computes any of these fields, for instances or instance templates. So I would recommend removing This also probably means we don't need |
Thanks for looking into this. I agree if there is no case where the API returns a value, we should not mark it computed.
This may be true, but it is our own team's convention to not allow an empty block to be specified. Like
|
The API bug seems to have been fixed now. I tried 4 cases:
This was tested with the v1 API. I hope beta works the same way too 😃 |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 159 insertions(+), 7 deletions(-)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks. Would you mind doing one last rebase off of master? I made changes to our CI and I want to make sure there aren't any hiccups. @upodroid
… into nested-virt-and-smt
Done |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 5 files changed, 159 insertions(+), 7 deletions(-)) |
Fixes: hashicorp/terraform-provider-google#9251
If this PR is for Terraform, I acknowledge that I have:
make test
andmake lint
to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)