terraform-google-modules / terraform-google-vm

Provisions VMs in Google Cloud
https://registry.terraform.io/modules/terraform-google-modules/vm/google
Apache License 2.0
220 stars 369 forks source link

feat(TPG>=5.5)!: support setting maintenance_interval in instance_template #357

Closed tpdownes closed 8 months ago

tpdownes commented 1 year ago

Enable setting maintenance_interval in the scheduling block of instance templates. Must use google-beta provider but does not otherwise impact version. This might make it a breaking change from your perspective. I can edit commit and PR title appropriately.

tpdownes commented 1 year ago

FYI: in some further testing, I'm seeing an error upon updating the field from PERIODIC to null. It is trying to do the update in-place. This maybe a TPG problem or something we could guide with a replacement trigger.

tpdownes commented 1 year ago

I filed an issue in TPG: https://github.com/hashicorp/terraform-provider-google/issues/16345

Can you help me understand the integration test failure? It seems unrelated.

tpdownes commented 11 months ago

https://github.com/hashicorp/terraform-provider-google/issues/16345 resolves this problem, I believe but requires upgrade to TPG 5.x. Future work to add to this PR.

tpdownes commented 11 months ago

@terraform-google-modules/cft-admins I would appreciate feedback on this PR as it changes to google-beta and bumps to 5.x. I could answer why this might be a support burden.

apeabody commented 11 months ago

From the CI:

STDERR: Error: cannot determine self_link for subnetwork "cft-vm-test-9wb5": network_interface.0.subnetwork_project: required field is not set

  with module.preemptible_and_regular_instance_templates.module.preemptible_and_regular_instance_templates.module.preemptible.google_compute_instance_template.tpl,
  on ../../../../modules/instance_template/main.tf line 65, in resource "google_compute_instance_template" "tpl":
  65: resource "google_compute_instance_template" "tpl" {
tpdownes commented 10 months ago

From the CI:

STDERR: Error: cannot determine self_link for subnetwork "cft-vm-test-9wb5": network_interface.0.subnetwork_project: required field is not set

  with module.preemptible_and_regular_instance_templates.module.preemptible_and_regular_instance_templates.module.preemptible.google_compute_instance_template.tpl,
  on ../../../../modules/instance_template/main.tf line 65, in resource "google_compute_instance_template" "tpl":
  65: resource "google_compute_instance_template" "tpl" {

It's unclear to me if CFT believes the correct solution here is to set the project ID at provider level or to explicitly supply subnetwork_project. Not exactly clear why this is showing up as part of this PR as it's not a documented breaking change for TPG 5.0.

https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/version_5_upgrade

g-awmalik commented 8 months ago

@apeabody - can you LGTM this?