A Terraform module for creating a AWS Lambda function that will search for and terminate any stale packer instances.
An instance will be marked as stale when it has existed for over 2 hours.
The module will create a IAM policy allowing the lambda function to describe EC2, terminate EC2 and full access to cloudwatch logs. It will also create a cloudwatch event and schedule that will trigger the function, the rate for this defualts to every 2 hours and is customisable.
This module makes the following assumptions:
* You have already defined the provider already
* You have already configured packer and are tagging the instances with the tag 'Packer Builder'. To change the tag you will need to edit packer_janitor.py and create a new zip file.
* You are within the eu-west-1 region, to change this you will need to edit the python script and generate a new zip file.
Input Variables
---------------
-`cloudwatch_schedule` - The ID of the VPC.
Usage
-----
You can use this in your terraform template with the following steps.
1.) Adding a module resource to your template, e.g. `main.tf`