lambda-elasticsearch-cleanup

cloudposse/lambda-elasticsearch-cleanup/aws

Terraform Module HCL AWS

Terraform module to provision a scheduled Lambda function which will delete old AWS ElasticSearch indices

Install
module "lambda-elasticsearch-cleanup" {
source = "cloudposse/lambda-elasticsearch-cleanup/aws"
version = "0.16.1"
}
⭐ Source on GitHub 📦 Registry page
README

Terraform module to provision a scheduled Lambda function which will delete old Elasticsearch indexes using SigV4Auth authentication. The lambda function can optionally send output to an SNS topic if the topic ARN is given. This module was largely inspired by aws-lambda-es-cleanup > [!TIP] > #### 👽 Use Atmos with Terraform > Cloud Posse uses atmos to easily orchestrate multiple environments using Terraform. > Works with Github Actions, Atlantis, or Spacelift. > > > Watch demo of using Atmos with Terraform > > Example of running <

Inputs (33)
NameTypeDescriptionDefault
es_endpointstringThe Elasticsearch endpoint for the Lambda function to connect to required
es_domain_arnstringThe Elasticsearch domain ARN required
es_security_group_idstringThe Elasticsearch cluster security group ID required
subnet_idslist(string)Subnet IDs required
vpc_idstringThe VPC ID for the Lambda function required
attributeslist(string)ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`, []
labels_as_tagsset(string)Set of labels (ID elements) to include as tags in the `tags` output. Default is [ "default" ]
label_orderlist(string)The order in which the labels (ID elements) appear in the `id`. Defaults to ["nanull
index_restringRegular Expression that matches the index names to clean up (not including trail".*"
timeoutnumberTimeout for Lambda function in seconds300
tagsmap(string)Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`). Neither the tag keys nor the t{}
index_formatstringCombined with 'index' variable and is used to evaluate the index age"%Y.%m.%d"
namespacestringID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp'null
environmentstringID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'stnull
additional_tag_mapmap(string)Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not add{}
descriptor_formatsanyDescribe additional descriptors to be output in the `descriptors` output map. Ma{}
artifact_urlstringURL template for the remote artifact"https://artifacts.cloudposse.com/$${mod
tenantstringID element _(Rarely used, not included by default)_. A customer identifier, indinull
id_length_limitnumberLimit `id` to this many characters (minimum 6). Set to `0` for unlimited length.null
python_versionstringThe Python version to use"3.12"
stagestringID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'bunull
label_value_casestringControls the letter case of ID elements (labels) as included in `id`, set as tagnull
enabledboolSet to false to prevent the module from creating any resourcesnull
label_key_casestringControls the letter case of the `tags` keys (label names) for tags generated by null
schedulestringCloudWatch Events rule schedule using cron or rate expression"cron(0 3 * * ? *)"
Outputs (3)
security_group_id — Security Group ID of the Lambda Function
lambda_function_arn — ARN of the Lambda Function
lambda_function_source_code_size — The size in bytes of the function .zip file
Resources (9)
aws_cloudwatch_event_ruleaws_cloudwatch_event_targetaws_iam_roleaws_iam_role_policyaws_iam_role_policy_attachmentaws_lambda_functionaws_lambda_permissionaws_security_groupaws_security_group_rule
Details
FrameworkTerraform Module
LanguageHCL
Version0.16.1
Cloud AWS
★ Stars13
Forks12
Total downloads59.5k
Inputs33
Outputs3
Resources9
Examples1
LicenseApache-2.0
Namespacecloudposse
Updated