Skip to content

Latest commit

 

History

History
82 lines (60 loc) · 4.64 KB

File metadata and controls

82 lines (60 loc) · 4.64 KB

Description

This modules create a resource policy for compute engines. This policy can be passed to a gke-node-pool module to apply the policy on the node-pool's nodes.

Note: By default, you can't apply compact placement policies with a max distance value to A3 VMs. To request access to this feature, contact your Technical Account Manager (TAM) or the Sales team.

Example

The following example creates a group placement resource policy and applies it to a gke-node-pool.

  - id: group_placement_1
    source: modules/compute/resource-policy
    settings:
      name: gp-np-1
      group_placement_max_distance: 2

  - id: node_pool_1
    source: modules/compute/gke-node-pool
    use: [group_placement_1]
    settings:
      machine_type: e2-standard-8
    outputs: [instructions]

Copyright 2026 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Requirements

Name Version
terraform = 1.12.2
google-beta >= 6.29.0
random ~> 3.0

Providers

Name Version
google-beta >= 6.29.0
random ~> 3.0

Modules

No modules.

Resources

Name Type
google-beta_google_compute_resource_policy.policy resource
random_id.resource_name_suffix resource

Inputs

Name Description Type Default Required
group_placement_max_distance The max distance for group placement policy to use for the node pool's nodes. If set it will add a compact group placement policy.
Note: Placement policies have the following restrictions.
number 0 no
name The resource policy's name. string n/a yes
project_id The project ID for the resource policy. string n/a yes
region The region for the the resource policy. string n/a yes
workload_policy Describes the workload policy
object({
type = optional(string, null)
max_topology_distance = optional(string, null)
accelerator_topology = optional(string, null)
})
{
"accelerator_topology": null,
"max_topology_distance": null,
"type": null
}
no

Outputs

Name Description
placement_policy Group placement policy to use for placing VMs or GKE nodes placement. COMPACT is the only supported value for type currently. name is the name of the placement policy.
It is assumed that the specified policy exists. To create a placement policy refer to https://cloud.google.com/sdk/gcloud/reference/compute/resource-policies/create/group-placement.
Note: Placement policies have the following restrictions.
The value tpu_topology is only used for TPU node pools. The gke-node-pool module ensures it is configured appropriately for only TPUs during placement policy mapping.