-
Notifications
You must be signed in to change notification settings - Fork 261
Adding A4X and Future NPI Support to JBVM #4834
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,6 +136,7 @@ resource "google_compute_resource_policy" "placement_policy" { | |
| availability_domain_count = try(var.placement_policy.availability_domain_count, null) | ||
| collocation = try(var.placement_policy.collocation, null) | ||
| max_distance = try(var.placement_policy.max_distance, null) | ||
| gpu_topology = try(var.placement_policy.gpu_topology, null) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -145,6 +146,7 @@ resource "null_resource" "replace_vm_trigger_from_placement" { | |
| availability_domain_count = try(tostring(var.placement_policy.availability_domain_count), "") | ||
| max_distance = try(tostring(var.placement_policy.max_distance), "") | ||
| collocation = try(var.placement_policy.collocation, "") | ||
| gpu_topology = try(var.placement_policy.gpu_topology, "") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -314,25 +314,30 @@ variable "placement_policy" { | |
| Control where your VM instances are physically located relative to each other within a zone. | ||
| See https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_resource_policy#nested_group_placement_policy | ||
| EOT | ||
|
|
||
| type = any # It's a workaround of lack of `optional` in Terraform 1.2 | ||
| type = object({ | ||
| vm_count = optional(number) | ||
| availability_domain_count = optional(number) | ||
| collocation = optional(string) | ||
| max_distance = optional(number) | ||
| gpu_topology = optional(string) | ||
| }) | ||
| default = null | ||
| validation { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the new type check, the validation blocks are not needed. The type checking will ensure the placement_policy is either null or a map of provided keys with each value of the specified type. Please ensure that this type validation is working on terraform version 1.5.7 (the ctk supported version). You can remove the valdiation blocks after testing to ensure that wrong values are flagged by the type checker |
||
| condition = var.placement_policy == null ? true : try(keys(var.placement_policy), null) != null | ||
| error_message = <<-EOT | ||
| The var.placement_policy should be either unset/null or be a map/object with | ||
| fields: vm_count (number), availability_domain_count (number), collocation (string), max_distance (number). | ||
| fields: vm_count (number), availability_domain_count (number), collocation (string), max_distance (number), gpu_topology (string). | ||
LAVEEN marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| EOT | ||
| } | ||
|
Comment on lines
325
to
331
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you've changed the type of |
||
|
|
||
| validation { | ||
| condition = alltrue([ | ||
| for k in try(keys(var.placement_policy), []) : contains([ | ||
| "vm_count", "availability_domain_count", "collocation", "max_distance"], k) | ||
| "vm_count", "availability_domain_count", "collocation", "max_distance", "gpu_topology"], k) | ||
| ]) | ||
| error_message = <<-EOT | ||
| The supported fields for var.placement_policy are: | ||
| vm_count (number), availability_domain_count (number), collocation (string), max_distance (number). | ||
| vm_count (number), availability_domain_count (number), collocation (string), max_distance (number), gpu_topology (string). | ||
| EOT | ||
| } | ||
| } | ||
|
|
||
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.
The documentation for
placement_policyhas some issues:</br>). They should be<br/>.typecolumn is stillany, but it has been updated to a specificobjecttype invariables.tf. The documentation should reflect this change, which may require regenerating the documentation.