terraform-google-modules / terraform-google-kubernetes-engine

Configures opinionated GKE clusters
https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google
Apache License 2.0
1.15k stars 1.17k forks source link

Adding resource_policy to GCEs within a Node Pool #2163

Open JavierTobar opened 3 weeks ago

JavierTobar commented 3 weeks ago

TL;DR

Attaching google_compute_resource_policy to GCEs within a Node Pool would allow us to have a sleeping schedule for all the VMs.

Terraform Resources

https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance.html#resource_policies

Detailed design

The `google_compute_resource_policy` would be created as a standalone TF resource.
e.g. 

resource "google_compute_resource_policy" "weekday_hours_policy" {
  name   = "weekday-hours-policy"
# rest of config

When creating node_pools, we would pass a resource_policy for all the VMs within.

e.g.

{
      name                        = "weekday-hours-node-pool"
      resource_policy             = google_compute_resource_policy.weekday_hours_policy
      machine_type                = "n2d-standard-16"
      disk_size_gb                = 200
      disk_type                   = "pd-ssd"
# Rest of Config
    }


### Additional information

_No response_