Skip to content

terraform-aws-lambda-nuke

CI

Terraform module which create lambda which nuke all resources on aws account

Requirements

This role was developed using python lib boto3 1.13.34 Backwards compatibility is not guaranteed.

Terraform versions

For Terraform 0.15.* use version v2.* of this module.

If you are using Terraform 0.11 you can use versions v1.*.

Caveats

This following resources are not supported because creation timestamp are not present:

  • Compute
    • ecs
  • Database:
    • dax

Usage

module"nuke_everything_older_than_7d" {
source="diodonfrost/lambda-nuke/aws"name="nuke_everything"cloudwatch_schedule_expression="cron(0 00 ? * FRI *)"exclude_resources="key_pairs,rds"older_than="7d"
}

Examples

  • Compute-nuke Create lambda function to nuke compute resources on Friday at 23:00 Gmt

  • Storage-nuke Create lambda function to nuke storage resources on Friday at 23:00 Gmt

  • test fixture - Deploy environment for testing module with kitchen-ci and awspec

Inputs

NameDescriptionTypeDefaultRequired
nameDefine name to use for lambda function, cloudwatch event and iam rolestringn/ayes
custom_iam_role_arnCustom IAM role arn for the scheduling lambdastringnullno
kms_key_arnThe ARN for the KMS encryption key. If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service keystringnullno
aws_regionsA list of one or more aws regions where the lambda will be apply, default use the current regionlistnullno
cloudwatch_schedule_expressionThe scheduling expressionstring"cron(0 22 ? * MON-FRI *)"yes
exclude_resourcesDefine the resources that will be not destroyedstringnullno
older_thanOnly destroy resources that were created before a certain periodstring0dno
tagsA map of tags to assign to the resources.map(any)nullno

Outputs

NameDescription
lambda_iam_role_arnThe ARN of the IAM role used by Lambda function
lambda_iam_role_nameThe name of the IAM role used by Lambda function
nuke_lambda_arnThe ARN of the Lambda function
nuke_function_nameThe name of the Lambda function
nuke_lambda_invoke_arnThe ARN to be used for invoking Lambda function from API Gateway
nuke_lambda_function_last_modifiedThe date Lambda function was last modified
nuke_lambda_function_versionLatest published version of your Lambda function
scheduler_log_group_nameThe name of the scheduler log group
scheduler_log_group_arnThe Amazon Resource Name (ARN) specifying the log group

Authors

Modules managed by diodonfrost

Licence

Apache 2 Licensed. See LICENSE for full details.

Resources

About

Terraform module which create lambda which destroy all resources on aws account

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages