ansible-collections / ansible-collections/google.cloud

gcp_compute_instance: Support maxRunDuration

Open
#764 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
105
Forks
144
Avg merge
5d 10h
Merged PRs (30d)
4

Description

##### SUMMARY

Support the [`maxRunDuration`](https://docs.cloud.google.com/compute/docs/instances/limit-vm-runtime) option for Google Compute Engine instances.

##### ISSUE TYPE
- Feature Idea

##### COMPONENT NAME

This would be a new option `max_run_duration` under `scheduling` option and would be specified as an integer in seconds.

An additional `instance_termination_action` option would determine how the instance is terminated at the end of the run duration. Valid values are `"STOP"` or `"DELETE"`.

##### ADDITIONAL INFORMATION

This would be used in situations where you want to ensure VMs are terminated after some time. For example, if you are creating VMs to execute [molecule](https://docs.ansible.com/projects/molecule/) tests.

An example call is as follows:

```yaml
- name: create a instance
google.cloud.gcp_compute_instance:
name: test_object
machine_type: n1-standard-1
zone: us-central1-a
project: test_project
scheduling:
max_run_duration: 3600
instance_termination_action: STOP
state: present
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the google.cloud.gcp_compute_instance module and its scheduling option handling. Review the linked Google Compute Engine maxRunDuration documentation and the existing instance-creation behavior. Done means scheduling accepts max_run_duration in seconds and instance_termination_action with STOP or DELETE behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, python
Domain
cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.