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

Please expose resource_policies as a variable for the instance_template #315

Closed
ryboe opened this issue Jun 14, 2023 · 2 comments · Fixed by #317
Closed

Please expose resource_policies as a variable for the instance_template #315

ryboe opened this issue Jun 14, 2023 · 2 comments · Fixed by #317
Labels
enhancement New feature or request

Comments

@ryboe
Copy link
Contributor

ryboe commented Jun 14, 2023

TL;DR

The google_compute_instance_template resource supports adding a resource_policy, but it's not exposed as a variable in this module. I would like to set a policy that the instance is restarted weekly. Please add something like this to variables.tf so we can set resource policies.

variable "resource_policies" {
  type = list(string)
}

Terraform Resources

  1. google_compute_instance_template.resource_policies
  2. google_compute_resource_policy

Detailed design

module "instance_template" {
  source  = "terraform-google-modules/vm/google//modules/instance_template"
  ...
  resource_policies = [ google_compute_resource_policy.sunday_night_restart.self_link ]
}

resource "google_compute_resource_policy" "sunday_night_restart" {
  name   = "sunday-night-restart"
  region = "us-central1"
  description = "Sunday night restart"
  instance_schedule_policy {
    vm_start_schedule {
      schedule = "30 23 * * 7"
    }
    vm_stop_schedule {
      schedule = "0 23 * * 7"
    }
    time_zone = "US/Central"
  }
}

Additional information

No response

@tpdownes
Copy link
Member

In addition to the use case noted above, resource policies can also be used to specify "placement" in Google Cloud. In large scale HPC workloads, the placement policy can specify the maximum network "distance" allowed between VMs to minimize network latency of workloads that are coupled across VMs.

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants