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

Support max_run_duration for VM #13005

Closed
andrewyz opened this issue Nov 10, 2022 · 12 comments
Closed

Support max_run_duration for VM #13005

andrewyz opened this issue Nov 10, 2022 · 12 comments

Comments

@andrewyz
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

New or Affected Resource(s)

  • google_compute_instance
  • google_compute_instance_template

Potential Terraform Configuration

# Propose what you think the configuration to take advantage of this feature should look like.
# We may not use it verbatim, but it's helpful in understanding your intent.
resource "google_compute_instance" "foo" {
  # ...
  scheduling {
    max_run_duration {
      nanos = 123
      seconds = 60
    }
  }
}

References

@logicbomb421
Copy link

I'm also looking for this to be added. Do we know when the related PR will be merged and released by chance?

@philip-harvey
Copy link

I'm curious as to why max_run_duration doesn't support the STOP action currently, is this an API issue?

@andrewyz
Copy link
Author

andrewyz commented Feb 2, 2023

STOP action is not compatible with Terraform, as GCP will wipe out the timer once it get stopped, and Terraform will lost visibility on this.

@philip-harvey
Copy link

STOP action is not compatible with Terraform, as GCP will wipe out the timer once it get stopped, and Terraform will lost visibility on this.

I'm not following, I don't see how Terraform needs to track the run timer, only set the max run duration via the API call. Does the API fail to return the max run duration setting when the instance is stopped?
It seems a lot worse to have the max run duration action locked to terminate since every time you run terraform it will recreate the instance, and then GCP will delete the instance, and GCP will delete it, etc

@andrewyz
Copy link
Author

andrewyz commented Feb 2, 2023

Does the API fail to return the max run duration setting when the instance is stopped

Yes, that is why we cannot do it in Terraform, if an instance gets stopped, and max run duration is gone, Terraform cannot understand why there is such a mismatch, and, given the limitation that max run duration can only be updated when the instance is stopped. There isn't a feasible way to work out smoothly.

Unfortunately, given the current STOP behavior is not welcomed by Terraform, we made a hard decision to only support the termination at this point. We might consider adding STOP once we improve the API, and this being approved by Terraform in future.

@philip-harvey
Copy link

The GUI displays the max run duration even when the VM is stopped, so it seems this is an API bug. Has an upstream issue been created? I am happy to create one on issue tracker if needed.

@andrewyz
Copy link
Author

andrewyz commented Feb 2, 2023

This is intended behavior, but I will sync with the team shortly to see if any recent change has improved the API recently.

@rileykarson
Copy link
Collaborator

Closing as this was added in GoogleCloudPlatform/magic-modules#6812. If there's additional stuff to track after the initial change, could we spin out a new issue?

@philip-harvey
Copy link

The limitation of having the only supported action being DELETE makes this not usable for most scenarios, max_run_duration supports STOP as an action via GUI and CLI. Not sure this issue should be closed since the implementation doesn't yet support STOP action. However if it needs to be closed then I'm OK with opening a new issue to add the missing support for the STOP action.

@rileykarson
Copy link
Collaborator

Yeah, a new issue for STOP would be useful! That'll mean that we consolidate information about STOP there, rather than have this issue serve dual purposes.

@philip-harvey
Copy link

#13671

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants