From 8e1cef461221ebb59e272224b831c50f8a69b199 Mon Sep 17 00:00:00 2001 From: vadim-hleif Date: Wed, 18 Jul 2018 15:59:04 +0300 Subject: [PATCH] Migrate readme yaml --- .gitignore | 3 + Makefile | 6 +- README.md | 194 ++++++++++++++++++++++++++++++++++------------ README.yaml | 85 ++++++++++++++++++++ docs/targets.md | 9 +++ docs/terraform.md | 35 +++++++++ output.tf | 12 ++- 7 files changed, 289 insertions(+), 55 deletions(-) create mode 100644 README.yaml create mode 100644 docs/targets.md create mode 100644 docs/terraform.md diff --git a/.gitignore b/.gitignore index eaca7e3..923f13f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ .terraform .idea *.iml + +.build-harness +build-harness \ No newline at end of file diff --git a/Makefile b/Makefile index b0f7470..655f630 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ SHELL := /bin/bash +# List of targets the `readme` target should call before generating the readme +export README_DEPS ?= docs/targets.md docs/terraform.md + -include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness) +## Lint terraform code lint: - $(SELF) terraform:install terraform:get-modules terraform:get-plugins terraform:lint terraform:validate + $(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate \ No newline at end of file diff --git a/README.md b/README.md index 3e6b57d..990f781 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -# terraform-aws-s3-log-storage [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-s3-log-storage.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-s3-log-storage) + + +[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com) + +# terraform-aws-s3-log-storage [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-s3-log-storage.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-s3-log-storage) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-s3-log-storage.svg)](https://github.com/cloudposse/terraform-aws-s3-log-storage/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com) + This module creates an S3 bucket suitable for receiving logs from other `AWS` services such as `S3`, `CloudFront`, and `CloudTrails`. @@ -9,6 +14,22 @@ It enables server-side default encryption. https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html +--- + +This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. + + +It's 100% Open Source and licensed under the [APACHE2](LICENSE). + + + + + + + + + + ## Usage ```hcl @@ -26,38 +47,66 @@ module "log_storage" { ``` -## Variables -| Name | Default | Description | Required | -|:------------------------------------|:-------------------:|:---------------------------------------------------------------------------------------------------|:--------:| -| `namespace` | `` | Namespace (e.g. `cp` or `cloudposse`) | Yes | -| `stage` | `` | Stage (e.g. `prod`, `dev`, `staging`) | Yes | -| `name` | `` | Name (e.g. `log`) | Yes | -| `attributes` | `[]` | Additional attributes (e.g. `policy` or `role`) | No | -| `tags` | `{}` | Additional tags (e.g. `map("BusinessUnit","XYZ")` | No | -| `acl` | `log-delivery-write`| The canned ACL to apply | No | -| `policy` | `` | A valid bucket policy JSON document | No | -| `prefix` | `` | Object key prefix identifying one or more objects to which the lifecycle rule applies | No | -| `region` | `` | If specified, the AWS region this bucket should reside in. Defaults to region of callee. | No | -| `force_destroy` | `` | All objects will be forcefully deleted from the bucket when bucket destroyed | No | -| `lifecycle_rule_enabled` | `true` | Enable object lifecycle rules on this bucket | No | -| `versioning_enabled` | `false` | Versioning is a means of keeping multiple variants of an object in the same bucket | No | -| `noncurrent_version_transition_days`| `30` | Number of days to persist in the standard storage tier before moving to the glacier tier | No | -| `noncurrent_version_expiration_days`| `90` | Specifies when noncurrent object versions expire | No | -| `standard_transition_days` | `30` | Number of days to persist in the standard storage tier before moving to the infrequent access tier | No | -| `glacier_transition_days` | `60` | Number of days after which to move the data to the glacier storage tier | No | -| `expiration_days` | `90` | Number of days after which to expunge the objects | No | -| `sse_algorithm` | `AES256` | The server-side encryption algorithm to use. Valid values are `AES256` and `aws:kms` | No | -| `kms_master_key_id` | `` | The AWS KMS master key ID used for the SSE-KMS encryption. This can only be used when you set the value of `sse_algorithm` as `aws:kms`. The default AWS/S3 AWS KMS master key is used if this element is absent while the sse_algorithm is `aws:kms` | No | + + +## Makefile Targets +``` +Available targets: + + help This help screen + help/all Display help for all targets + lint Lint terraform code + +``` + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| acl | (Optional) The canned ACL to apply. We recommend log-delivery-write for compatibility with AWS services | string | `log-delivery-write` | no | +| attributes | Additional attributes (e.g. `policy` or `role`) | list | `` | no | +| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | +| expiration_days | Number of days after which to expunge the objects | string | `90` | no | +| force_destroy | (Optional, Default:false ) A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable. | string | `false` | no | +| glacier_transition_days | Number of days after which to move the data to the glacier storage tier | string | `60` | no | +| kms_master_key_id | The AWS KMS master key ID used for the SSE-KMS encryption. This can only be used when you set the value of sse_algorithm as aws:kms. The default aws/s3 AWS KMS master key is used if this element is absent while the sse_algorithm is aws:kms | string | `` | no | +| lifecycle_rule_enabled | (Optional) enable lifecycle events on this bucket | string | `true` | no | +| name | Name (e.g. `app` or `db`) | string | - | yes | +| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes | +| noncurrent_version_expiration_days | (Optional) Specifies when noncurrent object versions expire. | string | `90` | no | +| noncurrent_version_transition_days | (Optional) Specifies when noncurrent object versions transitions | string | `30` | no | +| policy | A valid bucket policy JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a terraform plan. In this case, please make sure you use the verbose/specific version of the policy. | string | `` | no | +| prefix | (Optional) Key prefix. Used to manage object lifecycle events. | string | `` | no | +| region | (Optional) If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee. | string | `` | no | +| sse_algorithm | The server-side encryption algorithm to use. Valid values are AES256 and aws:kms | string | `AES256` | no | +| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | +| standard_transition_days | Number of days to persist in the standard storage tier before moving to the infrequent access tier | string | `30` | no | +| tags | Additional tags (e.g. map('BusinessUnit`,`XYZ`) | map | `` | no | +| versioning_enabled | (Optional) A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket. | string | `false` | no | + ## Outputs -| Name | Description | -|:----------------------|:--------------------------------------| -| `bucket_domain_name` | FQDN of bucket | -| `bucket_id` | Bucket Name (aka ID) | -| `bucket_arn` | Bucket ARN | -| `prefix` | Prefix configured for lifecycle rules | +| Name | Description | +|------|-------------| +| bucket_arn | Bucket ARN | +| bucket_domain_name | FQDN of bucket | +| bucket_id | Bucket Name (aka ID) | +| prefix | Prefix configured for lifecycle rules | + + + + +## Related Projects + +Check out these related projects. + +- [terraform-aws-cloudfront-s3-cdn](https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn) - Terraform module to easily provision CloudFront CDN backed by an S3 origin +- [terraform-aws-s3-website](https://github.com/cloudposse/terraform-aws-s3-website) - Terraform Module for Creating S3 backed Websites and Route53 DNS +- [terraform-aws-user-data-s3-backend](https://github.com/cloudposse/terraform-aws-user-data-s3-backend) - Terraform Module to Offload User Data to S3 +- [terraform-aws-s3-logs-athena-query](https://github.com/cloudposse/terraform-aws-s3-logs-athena-query) - A Terraform module that creates an Athena Database and Structure for querying S3 access logs +- [terraform-aws-lb-s3-bucket](https://github.com/cloudposse/terraform-aws-lb-s3-bucket) - Terraform module to provision an S3 bucket with built in IAM policy to allow AWS Load Balancers to ship access logs @@ -65,8 +114,28 @@ module "log_storage" { **Got a question?** -File a GitHub [issue](https://github.com/cloudposse/terraform-aws-s3-log-storage/issues), send us an [email](mailto:hello@cloudposse.com) or reach out to us on [Gitter](https://gitter.im/cloudposse/). +File a GitHub [issue](https://github.com/cloudposse/terraform-aws-s3-log-storage/issues), send us an [email][email] or join our [Slack Community][slack]. + +## Commerical Support + +Work directly with our team of DevOps experts via email, slack, and video conferencing. + +We provide *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 fulltime engineer. + +[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)](mailto:hello@cloudposse.com) +- **Questions.** We'll use a Shared Slack channel between your team and ours. +- **Troubleshooting.** We'll help you triage why things aren't working. +- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback. +- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects. +- **Build New Terraform Modules.** We'll develop original modules to provision infrastructure. +- **Cloud Architecture.** We'll assist with your cloud strategy and design. +- **Implementation.** We'll provide hands on support to implement our reference architectures. + + +## Community Forum + +Get access to our [Open Source Community Forum][slack] on Slack. It's **FREE** to join 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 *sweet* infrastructure. ## Contributing @@ -76,7 +145,7 @@ Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-s3-lo ### Developing -If you are interested in being a contributor and want to get involved in developing `terraform-aws-s3-log-storage`, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com). +If you are interested in being a contributor and want to get involved in developing this project or [help out](https://github.com/orgs/cloudposse/projects/3) with our other projects, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com). In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. @@ -84,14 +153,20 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow. 2. **Clone** the project to your own machine 3. **Commit** changes to your own branch 4. **Push** your work back up to your fork - 5. Submit a **Pull request** so that we can review your changes + 5. Submit a **Pull Request** so that we can review your changes + +**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request! + + +## Copyright -**NOTE:** Be sure to merge the latest from "upstream" before making a pull request! +Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com) -## License -[APACHE 2.0](LICENSE) © 2018 [Cloud Posse, LLC](https://cloudposse.com) +## License + +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) See [LICENSE](LICENSE) for full details. @@ -103,7 +178,7 @@ See [LICENSE](LICENSE) for full details. "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an @@ -113,31 +188,50 @@ See [LICENSE](LICENSE) for full details. under the License. -## About -`terraform-aws-s3-log-storage` is maintained and funded by [Cloud Posse, LLC][website]. -![Cloud Posse](https://cloudposse.com/logo-300x69.png) -Like it? Please let us know at -We love [Open Source Software](https://github.com/cloudposse/)! -See [our other projects][community] -or [hire us][hire] to help build your next cloud platform. +## Trademarks + +All other trademarks referenced herein are the property of their respective owners. + +## About + +This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at + +[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com) + +We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We love [Open Source Software](https://github.com/cloudposse/)! + +We offer paid support on all of our projects. + +Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation. + + [docs]: https://docs.cloudposse.com/ [website]: https://cloudposse.com/ - [community]: https://github.com/cloudposse/ + [github]: https://github.com/cloudposse/ + [jobs]: https://cloudposse.com/jobs/ [hire]: https://cloudposse.com/contact/ + [slack]: https://slack.cloudposse.com/ + [linkedin]: https://www.linkedin.com/company/cloudposse + [twitter]: https://twitter.com/cloudposse/ + [email]: mailto:hello@cloudposse.com ### Contributors -| [![Erik Osterman][erik_img]][erik_web]
[Erik Osterman][erik_web] | [![Andriy Knysh][andriy_img]][andriy_web]
[Andriy Knysh][andriy_web] | -|-------------------------------------------------------|------------------------------------------------------------------| +| [![Erik Osterman][osterman_avatar]][osterman_homepage]
[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]
[Andriy Knysh][aknysh_homepage] | [![Vladimir][SweetOps_avatar]][SweetOps_homepage]
[Vladimir][SweetOps_homepage] | +|---|---|---| + + [osterman_homepage]: https://github.com/osterman + [osterman_avatar]: https://github.com/osterman.png?size=150 + [aknysh_homepage]: https://github.com/aknysh + [aknysh_avatar]: https://github.com/aknysh.png?size=150 + [SweetOps_homepage]: https://github.com/SweetOps + [SweetOps_avatar]: https://github.com/SweetOps.png?size=150 + - [erik_img]: http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144 - [erik_web]: https://github.com/osterman/ - [andriy_img]: https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144 - [andriy_web]: https://github.com/aknysh/ diff --git a/README.yaml b/README.yaml new file mode 100644 index 0000000..ae292a9 --- /dev/null +++ b/README.yaml @@ -0,0 +1,85 @@ +--- +# +# This is the canonical configuration for the `README.md` +# Run `make readme` to rebuild the `README.md` +# + +# Name of this project +name: terraform-aws-s3-log-storage + +# Logo for this project +#logo: docs/logo.png + +# License of this project +license: "APACHE2" + +# Canonical GitHub repo +github_repo: cloudposse/terraform-aws-s3-log-storage + +# Badges to display +badges: + - name: "Build Status" + image: "https://travis-ci.org/cloudposse/terraform-aws-s3-log-storage.svg?branch=master" + url: "https://travis-ci.org/cloudposse/terraform-aws-s3-log-storage" + - name: "Latest Release" + image: "https://img.shields.io/github/release/cloudposse/terraform-aws-s3-log-storage.svg" + url: "https://github.com/cloudposse/terraform-aws-s3-log-storage/releases/latest" + - name: "Slack Community" + image: "https://slack.cloudposse.com/badge.svg" + url: "https://slack.cloudposse.com" + +related: + - name: "terraform-aws-cloudfront-s3-cdn" + description: "Terraform module to easily provision CloudFront CDN backed by an S3 origin" + url: "https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn" + - name: "terraform-aws-s3-website" + description: "Terraform Module for Creating S3 backed Websites and Route53 DNS" + url: "https://github.com/cloudposse/terraform-aws-s3-website" + - name: "terraform-aws-user-data-s3-backend" + description: "Terraform Module to Offload User Data to S3" + url: "https://github.com/cloudposse/terraform-aws-user-data-s3-backend" + - name: "terraform-aws-s3-logs-athena-query" + description: "A Terraform module that creates an Athena Database and Structure for querying S3 access logs" + url: "https://github.com/cloudposse/terraform-aws-s3-logs-athena-query" + - name: "terraform-aws-lb-s3-bucket" + description: "Terraform module to provision an S3 bucket with built in IAM policy to allow AWS Load Balancers to ship access logs" + url: "https://github.com/cloudposse/terraform-aws-lb-s3-bucket" + +# Short description of this project +description: |- + This module creates an S3 bucket suitable for receiving logs from other `AWS` services such as `S3`, `CloudFront`, and `CloudTrails`. + + It implements a configurable log retention policy, which allows you to efficiently manage logs across different storage classes (_e.g._ `Glacier`) and ultimately expire the data altogether. + + It enables server-side default encryption. + + https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html + +# How to use this project +usage: |- + ```hcl + module "log_storage" { + source = "git::https://github.com/cloudposse/terraform-aws-s3-log-storage.git?ref=master" + name = "${var.name}" + stage = "${var.stage}" + namespace = "${var.namespace}" + acl = "${var.acl}" + prefix = "${var.prefix}" + standard_transition_days = "${var.standard_transition_days}" + glacier_transition_days = "${var.glacier_transition_days}" + expiration_days = "${var.expiration_days}" + } + ``` + +include: + - "docs/targets.md" + - "docs/terraform.md" + +# Contributors to this project +contributors: + - name: "Erik Osterman" + github: "osterman" + - name: "Andriy Knysh" + github: "aknysh" + - name: "Vladimir" + github: "SweetOps" \ No newline at end of file diff --git a/docs/targets.md b/docs/targets.md new file mode 100644 index 0000000..09c39cd --- /dev/null +++ b/docs/targets.md @@ -0,0 +1,9 @@ +## Makefile Targets +``` +Available targets: + + help This help screen + help/all Display help for all targets + lint Lint terraform code + +``` diff --git a/docs/terraform.md b/docs/terraform.md new file mode 100644 index 0000000..e30bcde --- /dev/null +++ b/docs/terraform.md @@ -0,0 +1,35 @@ + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| acl | (Optional) The canned ACL to apply. We recommend log-delivery-write for compatibility with AWS services | string | `log-delivery-write` | no | +| attributes | Additional attributes (e.g. `policy` or `role`) | list | `` | no | +| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no | +| expiration_days | Number of days after which to expunge the objects | string | `90` | no | +| force_destroy | (Optional, Default:false ) A boolean that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable. | string | `false` | no | +| glacier_transition_days | Number of days after which to move the data to the glacier storage tier | string | `60` | no | +| kms_master_key_id | The AWS KMS master key ID used for the SSE-KMS encryption. This can only be used when you set the value of sse_algorithm as aws:kms. The default aws/s3 AWS KMS master key is used if this element is absent while the sse_algorithm is aws:kms | string | `` | no | +| lifecycle_rule_enabled | (Optional) enable lifecycle events on this bucket | string | `true` | no | +| name | Name (e.g. `app` or `db`) | string | - | yes | +| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes | +| noncurrent_version_expiration_days | (Optional) Specifies when noncurrent object versions expire. | string | `90` | no | +| noncurrent_version_transition_days | (Optional) Specifies when noncurrent object versions transitions | string | `30` | no | +| policy | A valid bucket policy JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a terraform plan. In this case, please make sure you use the verbose/specific version of the policy. | string | `` | no | +| prefix | (Optional) Key prefix. Used to manage object lifecycle events. | string | `` | no | +| region | (Optional) If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee. | string | `` | no | +| sse_algorithm | The server-side encryption algorithm to use. Valid values are AES256 and aws:kms | string | `AES256` | no | +| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes | +| standard_transition_days | Number of days to persist in the standard storage tier before moving to the infrequent access tier | string | `30` | no | +| tags | Additional tags (e.g. map('BusinessUnit`,`XYZ`) | map | `` | no | +| versioning_enabled | (Optional) A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket. | string | `false` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| bucket_arn | Bucket ARN | +| bucket_domain_name | FQDN of bucket | +| bucket_id | Bucket Name (aka ID) | +| prefix | Prefix configured for lifecycle rules | + diff --git a/output.tf b/output.tf index 8aa08da..edfa073 100644 --- a/output.tf +++ b/output.tf @@ -1,15 +1,19 @@ output "bucket_domain_name" { - value = "${aws_s3_bucket.default.bucket_domain_name}" + value = "${aws_s3_bucket.default.bucket_domain_name}" + description = "FQDN of bucket" } output "bucket_id" { - value = "${aws_s3_bucket.default.id}" + value = "${aws_s3_bucket.default.id}" + description = "Bucket Name (aka ID)" } output "bucket_arn" { - value = "${aws_s3_bucket.default.arn}" + value = "${aws_s3_bucket.default.arn}" + description = "Bucket ARN" } output "prefix" { - value = "${var.prefix}" + value = "${var.prefix}" + description = "Prefix configured for lifecycle rules" }