Skip to content

Road-To-FinOps-Deploy/aws_tf_ebs_volumes_cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda Preventer

The script schedules the review of any ebs volumes that have been unattached for X days (deafult 7). 
This reviews all regions in your account

Usage

module "aws_tf_ebs_volumes_cleaner" { source = "/aws_tf_ebs_volumes_cleaner" }

Optional Inputs

Name Description Type Default Required
ebs_volumes_cleanup_cron Rate expression for when to run the review of volumes string "cron(0 7 ? * MON-FRI *)" no
function_prefix Prefix for the name of the lambda created string "" no
days how many days a volumes needs to be unattached to delete string "7" no
dryrun If this is a dry run or a real test. By default it will not be a dry run so will action string "False" no
bucket_name Add name of bucket if you wish to upload json file to s3 bucket string "" no

Tags

If you do not want it to be deleted then Tag Protection = True

It will run and tag volumes that need to be reviewed and will delete in a week

Testing

Configure your AWS credentials using one of the supported methods for AWS CLI tools, such as setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. If you're using the ~/.aws/config file for profiles then export AWS_SDK_LOAD_CONFIG as "True".

  1. Install Terraform and make sure it's on your PATH.
  2. Install Golang and make sure this code is checked out into your GOPATH. cd test go mod init github.com/sg/sch go test -v -run TestTerraformAwsExample

About

aws terraform moduel to Cleanup of unattached volumes by deleteing them

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors