|
| 1 | +<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. --> |
| 2 | +[![README Header][readme_header_img]][readme_header_link] |
| 3 | + |
| 4 | +[![Cloud Posse][logo]](https://cpco.io/homepage) |
| 5 | + |
| 6 | +# terraform-aws-lambda-elasticsearch-cleanup |
| 7 | + |
| 8 | + [](https://travis-ci.org/cloudposse/terraform-aws-lambda-elasticsearch-cleanup) [](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/releases/latest) [](https://slack.cloudposse.com) |
| 9 | + |
| 10 | + |
| 11 | +Terraform module to provision a scheduled Lambda function which will |
| 12 | +delete old Elasticsearch indexes using [SigV4Auth](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) authentication. The |
| 13 | +lambda function can optionally send output to an SNS topic if the |
| 14 | +topic ARN is given. This module was largely inspired by |
| 15 | +[aws-lambda-es-cleanup](https://github.com/cloudreach/aws-lambda-es-cleanup) |
| 16 | + |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps. |
| 21 | +[<img align="right" title="Share via Email" src="https://docs.cloudposse.com/images/ionicons/ios-email-outline-2.0.1-16x16-999999.svg"/>][share_email] |
| 22 | +[<img align="right" title="Share on Google+" src="https://docs.cloudposse.com/images/ionicons/social-googleplus-outline-2.0.1-16x16-999999.svg" />][share_googleplus] |
| 23 | +[<img align="right" title="Share on Facebook" src="https://docs.cloudposse.com/images/ionicons/social-facebook-outline-2.0.1-16x16-999999.svg" />][share_facebook] |
| 24 | +[<img align="right" title="Share on Reddit" src="https://docs.cloudposse.com/images/ionicons/social-reddit-outline-2.0.1-16x16-999999.svg" />][share_reddit] |
| 25 | +[<img align="right" title="Share on LinkedIn" src="https://docs.cloudposse.com/images/ionicons/social-linkedin-outline-2.0.1-16x16-999999.svg" />][share_linkedin] |
| 26 | +[<img align="right" title="Share on Twitter" src="https://docs.cloudposse.com/images/ionicons/social-twitter-outline-2.0.1-16x16-999999.svg" />][share_twitter] |
| 27 | + |
| 28 | + |
| 29 | +[][terraform_modules] |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +It's 100% Open Source and licensed under the [APACHE2](LICENSE). |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out! |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +## Usage |
| 50 | + |
| 51 | +```hcl |
| 52 | +module "elasticsearch_cleanup" { |
| 53 | + source = "../" |
| 54 | + es_endpoint = "${module.elasticsearch.domain_endpoint}" |
| 55 | + es_domain_arn = "${module.elasticsearch.domain_arn}" |
| 56 | + es_security_group_id = "${module.elasticsearch.security_group_id}" |
| 57 | + vpc_id = "${module.vpc.vpc_id}" |
| 58 | + namespace = "example" |
| 59 | + stage = "dev" |
| 60 | + schedule = "rate(5 minutes)" |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | +## Makefile Targets |
| 70 | +``` |
| 71 | +Available targets: |
| 72 | +
|
| 73 | + build Build Lambda function zip |
| 74 | + dependencies Install dependencies |
| 75 | + help Help screen |
| 76 | + help/all Display help for all targets |
| 77 | + help/short This help short screen |
| 78 | + lint Lint terraform code |
| 79 | +
|
| 80 | +``` |
| 81 | +## Module: cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 82 | + |
| 83 | +This module creates a scheduled Lambda function which will delete old |
| 84 | +Elasticsearch indexes using SigV4Auth authentication. The lambda |
| 85 | +function can optionally send output to an SNS topic if the topic ARN |
| 86 | +is given |
| 87 | + |
| 88 | +## Inputs |
| 89 | + |
| 90 | +| Name | Description | Type | Default | Required | |
| 91 | +|------|-------------|:----:|:-----:|:-----:| |
| 92 | +| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no | |
| 93 | +| delete_after | Number of days to preserve | string | `15` | no | |
| 94 | +| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no | |
| 95 | +| es_domain_arn | The Elasticsearch domain ARN | string | - | yes | |
| 96 | +| es_endpoint | The Elasticsearch endpoint for the Lambda function to connect to | string | - | yes | |
| 97 | +| es_security_group_id | The Elasticsearch cluster security group ID | string | - | yes | |
| 98 | +| index | Index/indices to process. Use a comma-separated list. Specify `all` to match every index except for `.kibana` | string | `all` | no | |
| 99 | +| index_format | Combined with 'index' variable and is used to evaluate the index age | string | `%Y.%m.%d` | no | |
| 100 | +| name | Solution name, e.g. 'app' or 'cluster' | string | `app` | no | |
| 101 | +| namespace | Namespace, which could be your organization name, e.g. 'eg' or 'cp' | string | - | yes | |
| 102 | +| python_version | The Python version to use | string | `2.7` | no | |
| 103 | +| schedule | CloudWatch Events rule schedule using cron or rate expression | string | `cron(0 3 * * ? *)` | no | |
| 104 | +| sns_arn | SNS ARN to pusblish alerts | string | `` | no | |
| 105 | +| stage | Stage, e.g. 'prod', 'staging', 'dev', or 'test' | string | - | yes | |
| 106 | +| subnet_ids | Subnet ids | list | - | yes | |
| 107 | +| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map | `<map>` | no | |
| 108 | +| timeout | Timeout for Lambda function in seconds | string | `300` | no | |
| 109 | +| vpc_id | The VPC ID for the Lambda function | string | - | yes | |
| 110 | + |
| 111 | +## Outputs |
| 112 | + |
| 113 | +| Name | Description | |
| 114 | +|------|-------------| |
| 115 | +| security_group_id | Security Group ID of the Lambda | |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +## Share the Love |
| 121 | + |
| 122 | +Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup)! (it helps us **a lot**) |
| 123 | + |
| 124 | +Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =) |
| 125 | + |
| 126 | + |
| 127 | +## Related Projects |
| 128 | + |
| 129 | +Check out these related projects. |
| 130 | + |
| 131 | +- [terraform-aws-vpc](https://github.com/cloudposse/terraform-aws-vpc) - Terraform Module that defines a VPC with public/private subnets across multiple AZs with Internet Gateways |
| 132 | +- [terraform-aws-dynamic-subnets](https://github.com/cloudposse/terraform-aws-dynamic-subnets) - Terraform module for dynamic subnets provisioning. |
| 133 | +- [terraform-aws-elasticsearch](https://github.com/cloudposse/terraform-aws-elasticsearch) - Terraform module for AWS Elasticsearch provisioning. |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | +## Help |
| 138 | + |
| 139 | +**Got a question?** |
| 140 | + |
| 141 | +File a GitHub [issue](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/issues), send us an [email][email] or join our [Slack Community][slack]. |
| 142 | + |
| 143 | +[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link] |
| 144 | + |
| 145 | +## Commercial Support |
| 146 | + |
| 147 | +Work directly with our team of DevOps experts via email, slack, and video conferencing. |
| 148 | + |
| 149 | +We provide [*commercial support*][commercial_support] for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a full-time engineer. |
| 150 | + |
| 151 | +[][email] |
| 152 | + |
| 153 | +- **Questions.** We'll use a Shared Slack channel between your team and ours. |
| 154 | +- **Troubleshooting.** We'll help you triage why things aren't working. |
| 155 | +- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback. |
| 156 | +- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects. |
| 157 | +- **Build New Terraform Modules.** We'll [develop original modules][module_development] to provision infrastructure. |
| 158 | +- **Cloud Architecture.** We'll assist with your cloud strategy and design. |
| 159 | +- **Implementation.** We'll provide hands-on support to implement our reference architectures. |
| 160 | + |
| 161 | + |
| 162 | + |
| 163 | +## Terraform Module Development |
| 164 | + |
| 165 | +Are you interested in custom Terraform module development? Submit your inquiry using [our form][module_development] today and we'll get back to you ASAP. |
| 166 | + |
| 167 | + |
| 168 | +## Slack Community |
| 169 | + |
| 170 | +Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure. |
| 171 | + |
| 172 | +## Newsletter |
| 173 | + |
| 174 | +Signup for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover. |
| 175 | + |
| 176 | +## Contributing |
| 177 | + |
| 178 | +### Bug Reports & Feature Requests |
| 179 | + |
| 180 | +Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup/issues) to report any bugs or file feature requests. |
| 181 | + |
| 182 | +### Developing |
| 183 | + |
| 184 | +If you are interested in being a contributor and want to get involved in developing this project or [help out](https://cpco.io/help-out) with our other projects, we would love to hear from you! Shoot us an [email][email]. |
| 185 | + |
| 186 | +In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. |
| 187 | + |
| 188 | + 1. **Fork** the repo on GitHub |
| 189 | + 2. **Clone** the project to your own machine |
| 190 | + 3. **Commit** changes to your own branch |
| 191 | + 4. **Push** your work back up to your fork |
| 192 | + 5. Submit a **Pull Request** so that we can review your changes |
| 193 | + |
| 194 | +**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! |
| 195 | + |
| 196 | + |
| 197 | +## Copyright |
| 198 | + |
| 199 | +Copyright © 2017-2018 [Cloud Posse, LLC](https://cpco.io/copyright) |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | +## License |
| 204 | + |
| 205 | +[](https://opensource.org/licenses/Apache-2.0) |
| 206 | + |
| 207 | +See [LICENSE](LICENSE) for full details. |
| 208 | + |
| 209 | + Licensed to the Apache Software Foundation (ASF) under one |
| 210 | + or more contributor license agreements. See the NOTICE file |
| 211 | + distributed with this work for additional information |
| 212 | + regarding copyright ownership. The ASF licenses this file |
| 213 | + to you under the Apache License, Version 2.0 (the |
| 214 | + "License"); you may not use this file except in compliance |
| 215 | + with the License. You may obtain a copy of the License at |
| 216 | + |
| 217 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 218 | + |
| 219 | + Unless required by applicable law or agreed to in writing, |
| 220 | + software distributed under the License is distributed on an |
| 221 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 222 | + KIND, either express or implied. See the License for the |
| 223 | + specific language governing permissions and limitations |
| 224 | + under the License. |
| 225 | + |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | + |
| 234 | +## Trademarks |
| 235 | + |
| 236 | +All other trademarks referenced herein are the property of their respective owners. |
| 237 | + |
| 238 | +## About |
| 239 | + |
| 240 | +This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know by [leaving a testimonial][testimonial]! |
| 241 | + |
| 242 | +[![Cloud Posse][logo]][website] |
| 243 | + |
| 244 | +We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️ [Open Source Software][we_love_open_source]. |
| 245 | + |
| 246 | +We offer [paid support][commercial_support] on all of our projects. |
| 247 | + |
| 248 | +Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation. |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | +### Contributors |
| 253 | + |
| 254 | +| [![Josh Myers][joshmyers_avatar]][joshmyers_homepage]<br/>[Josh Myers][joshmyers_homepage] | |
| 255 | +|---| |
| 256 | + |
| 257 | + [joshmyers_homepage]: https://github.com/joshmyers |
| 258 | + [joshmyers_avatar]: https://github.com/joshmyers.png?size=150 |
| 259 | + |
| 260 | + |
| 261 | + |
| 262 | +[![README Footer][readme_footer_img]][readme_footer_link] |
| 263 | +[![Beacon][beacon]][website] |
| 264 | + |
| 265 | + [logo]: https://cloudposse.com/logo-300x69.svg |
| 266 | + [docs]: https://cpco.io/docs |
| 267 | + [website]: https://cpco.io/homepage |
| 268 | + [github]: https://cpco.io/github |
| 269 | + [jobs]: https://cpco.io/jobs |
| 270 | + [hire]: https://cpco.io/hire |
| 271 | + [slack]: https://cpco.io/slack |
| 272 | + [linkedin]: https://cpco.io/linkedin |
| 273 | + [twitter]: https://cpco.io/twitter |
| 274 | + [testimonial]: https://cpco.io/leave-testimonial |
| 275 | + [newsletter]: https://cpco.io/newsletter |
| 276 | + [email]: https://cpco.io/email |
| 277 | + [commercial_support]: https://cpco.io/commercial-support |
| 278 | + [we_love_open_source]: https://cpco.io/we-love-open-source |
| 279 | + [module_development]: https://cpco.io/module-development |
| 280 | + [terraform_modules]: https://cpco.io/terraform-modules |
| 281 | + [readme_header_img]: https://cloudposse.com/readme/header/img?repo=cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 282 | + [readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 283 | + [readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 284 | + [readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 285 | + [readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 286 | + [readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 287 | + [share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-lambda-elasticsearch-cleanup&url=https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 288 | + [share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-lambda-elasticsearch-cleanup&url=https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 289 | + [share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 290 | + [share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 291 | + [share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 292 | + [share_email]: mailto:?subject=terraform-aws-lambda-elasticsearch-cleanup&body=https://github.com/cloudposse/terraform-aws-lambda-elasticsearch-cleanup |
| 293 | + [beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-lambda-elasticsearch-cleanup?pixel&cs=github&cm=readme&an=terraform-aws-lambda-elasticsearch-cleanup |
0 commit comments