WORKFLOW

Delete GCP instances without valid `lifetime` tag

Use this workflow

This workflow looks at all of the GCP instances in a given account and zone and selects a subset of those to terminate. The termination criteria are:

  • Not labelled with a termination_date or lifetime after 4 mintutes
  • The termination_date or lifetime labels are present but cannot be parsed.
  • The termination_date or lifetime labels indicate that the instance has expired.

An instance may be configured to never terminate if its lifetime label has the special value indefinite. Other valid values for the lifetime label are of the form <number><unit> where <number> is any integer and <unit> is a time unit of w(weeks), h(hours), d(days) or m(months). So, as an example, if the lifetime label for an instance has a value of 43w then it should be terminated after it's 43 weeks old.

Code

Relay uses YAML to define the steps in a workflow.

Graph

Each step in the workflow is visualized below.
gcp-instance-reaper

Install the Relay CLI

Relay CLI is an essential companion for authoring and managing workflows. You can install it with a package manager or download it.
brew install puppetlabs/puppet/relay
Learn more about setting up Relay.

How to contribute

We’re excited to see and share in our community’s creation. Take a look at our community overview to learn how to begin contributing to Relay.