Skip to content

Commit 766e5c1

Browse files
authored
Migrate readme yaml (#6)
1 parent 855c618 commit 766e5c1

File tree

7 files changed

+290
-52
lines changed

7 files changed

+290
-52
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
.terraform/
77
.idea
88
terraform-aws-tfstate-backend.iml
9+
10+
.build-harness
11+
build-harness

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
SHELL := /bin/bash
22

3+
# List of targets the `readme` target should call before generating the readme
4+
export README_DEPS ?= docs/targets.md docs/terraform.md
5+
36
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
47

8+
## Lint terraform code
59
lint:
6-
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate
10+
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate

README.md

Lines changed: 119 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# terraform-aws-tfstate-backend [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-tfstate-backend.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-tfstate-backend)
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+
3+
[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com)
4+
5+
# terraform-aws-tfstate-backend [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-tfstate-backend.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-tfstate-backend) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-tfstate-backend.svg)](https://github.com/cloudposse/terraform-aws-tfstate-backend/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
6+
27

38
Terraform module to provision an S3 bucket to store `terraform.tfstate` file and a DynamoDB table to lock the state file
49
to prevent concurrent modifications and state corruption.
@@ -16,6 +21,17 @@ https://www.terraform.io/docs/backends/types/s3.html
1621
__NOTE:__ The operators of the module (IAM Users) must have permissions to create S3 buckets and DynamoDB tables when performing `terraform plan` and `terraform apply`
1722

1823

24+
---
25+
26+
This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps.
27+
28+
29+
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
30+
31+
32+
33+
34+
1935
## Usage
2036

2137
```hcl
@@ -66,42 +82,86 @@ and the DynamoDB table will be used to lock the state to prevent concurrent modi
6682
![s3-bucket-with-terraform-state](images/s3-bucket-with-terraform-state.png)
6783

6884

69-
## Variables
7085

71-
| Name | Default | Description | Required |
72-
|:---------------------------------|:-------------|:----------------------------------------------------------------------------------|:--------:|
73-
| `namespace` | `` | Namespace (_e.g._ `cp` or `cloudposse`) | Yes |
74-
| `stage` | `` | Stage (_e.g._ `prod`, `dev`, `staging`) | Yes |
75-
| `region` | `` | AWS Region the S3 bucket should reside in | Yes |
76-
| `name` | `terraform` | Name (_e.g._ `app`, `cluster`, or `terraform`) | No |
77-
| `attributes` | `["state"]` | Additional attributes (_e.g._ `state`) | No |
78-
| `tags` | `{}` | Additional tags (_e.g._ `map("BusinessUnit","XYZ")` | No |
79-
| `delimiter` | `-` | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | No |
80-
| `acl` | `private` | The canned ACL to apply to the S3 bucket | No |
81-
| `read_capacity` | `5` | DynamoDB read capacity units | No |
82-
| `write_capacity` | `5` | DynamoDB write capacity units | No |
83-
| `force_destroy` | `false` | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | No |
84-
| `enable_server_side_encryption` | `true` | Enable DynamoDB server-side encryption | No |
8586

8687

88+
89+
## Makefile Targets
90+
```
91+
Available targets:
92+
93+
help This help screen
94+
help/all Display help for all targets
95+
lint Lint terraform code
96+
97+
```
98+
99+
## Inputs
100+
101+
| Name | Description | Type | Default | Required |
102+
|------|-------------|:----:|:-----:|:-----:|
103+
| acl | The canned ACL to apply to the S3 bucket | string | `private` | no |
104+
| attributes | Additional attributes (e.g. `state`) | list | `<list>` | no |
105+
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
106+
| enable_server_side_encryption | Enable DynamoDB server-side encryption | string | `true` | no |
107+
| force_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | string | `false` | no |
108+
| name | Name (e.g. `app` or `cluster`) | string | `terraform` | no |
109+
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
110+
| read_capacity | DynamoDB read capacity units | string | `5` | no |
111+
| region | AWS Region the S3 bucket should reside in | string | - | yes |
112+
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes |
113+
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `<map>` | no |
114+
| write_capacity | DynamoDB write capacity units | string | `5` | no |
115+
87116
## Outputs
88117

89-
| Name | Description |
90-
|:-------------------------|:-----------------------------|
91-
| `s3_bucket_domain_name` | S3 bucket domain name |
92-
| `s3_bucket_id` | S3 bucket ID |
93-
| `s3_bucket_arn` | S3 bucket ARN |
94-
| `dynamodb_table_id` | DynamoDB table ID |
95-
| `dynamodb_table_arn` | DynamoDB table ARN |
96-
| `dynamodb_table_name` | DynamoDB table name |
118+
| Name | Description |
119+
|------|-------------|
120+
| dynamodb_table_arn | DynamoDB table ARN |
121+
| dynamodb_table_id | DynamoDB table ID |
122+
| dynamodb_table_name | DynamoDB table name |
123+
| s3_bucket_arn | S3 bucket ARN |
124+
| s3_bucket_domain_name | S3 bucket domain name |
125+
| s3_bucket_id | S3 bucket ID |
126+
127+
128+
129+
130+
## Related Projects
131+
132+
Check out these related projects.
133+
134+
- [terraform-aws-dynamodb](https://github.com/cloudposse/terraform-aws-dynamodb) - Terraform module that implements AWS DynamoDB with support for AutoScaling
135+
- [terraform-aws-dynamodb-autoscaler](https://github.com/cloudposse/terraform-aws-dynamodb-autoscaler) - Terraform module to provision DynamoDB autoscaler
136+
97137

98138

99139
## Help
100140

101141
**Got a question?**
102142

103-
File a GitHub [issue](https://github.com/cloudposse/terraform-aws-tfstate-backend/issues), send us an [email](mailto:hello@cloudposse.com) or reach out to us on [Gitter](https://gitter.im/cloudposse/).
143+
File a GitHub [issue](https://github.com/cloudposse/terraform-aws-tfstate-backend/issues), send us an [email][email] or join our [Slack Community][slack].
144+
145+
## Commerical Support
146+
147+
Work directly with our team of DevOps experts via email, slack, and video conferencing.
148+
149+
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.
150+
151+
[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)](mailto:hello@cloudposse.com)
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 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+
104161

162+
## Community Forum
163+
164+
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.
105165

106166
## Contributing
107167

@@ -111,22 +171,28 @@ Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-tfsta
111171

112172
### Developing
113173

114-
If you are interested in being a contributor and want to get involved in developing `terraform-aws-tfstate-backend`, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com).
174+
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).
115175

116176
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
117177

118178
1. **Fork** the repo on GitHub
119179
2. **Clone** the project to your own machine
120180
3. **Commit** changes to your own branch
121181
4. **Push** your work back up to your fork
122-
5. Submit a **Pull request** so that we can review your changes
182+
5. Submit a **Pull Request** so that we can review your changes
183+
184+
**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!
185+
186+
187+
## Copyright
188+
189+
Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com)
123190

124-
**NOTE:** Be sure to merge the latest from "upstream" before making a pull request!
125191

126192

127-
## License
193+
## License
128194

129-
[APACHE 2.0](LICENSE) © 2018 [Cloud Posse, LLC](https://cloudposse.com)
195+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
130196

131197
See [LICENSE](LICENSE) for full details.
132198

@@ -138,7 +204,7 @@ See [LICENSE](LICENSE) for full details.
138204
"License"); you may not use this file except in compliance
139205
with the License. You may obtain a copy of the License at
140206

141-
http://www.apache.org/licenses/LICENSE-2.0
207+
https://www.apache.org/licenses/LICENSE-2.0
142208

143209
Unless required by applicable law or agreed to in writing,
144210
software distributed under the License is distributed on an
@@ -148,31 +214,39 @@ See [LICENSE](LICENSE) for full details.
148214
under the License.
149215

150216

151-
## About
217+
## Trademarks
218+
219+
All other trademarks referenced herein are the property of their respective owners.
152220

153-
`terraform-aws-tfstate-backend` is maintained and funded by [Cloud Posse, LLC][website].
221+
## About
154222

155-
![Cloud Posse](https://cloudposse.com/logo-300x69.png)
223+
This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at <hello@cloudposse.com>
156224

225+
[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com)
157226

158-
Like it? Please let us know at <hello@cloudposse.com>
227+
We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We love [Open Source Software](https://github.com/cloudposse/)!
159228

160-
We love [Open Source Software](https://github.com/cloudposse/)!
229+
We offer paid support on all of our projects.
161230

162-
See [our other projects][community]
163-
or [hire us][hire] to help build your next cloud platform.
231+
Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.
164232

233+
[docs]: https://docs.cloudposse.com/
165234
[website]: https://cloudposse.com/
166-
[community]: https://github.com/cloudposse/
235+
[github]: https://github.com/cloudposse/
236+
[jobs]: https://cloudposse.com/jobs/
167237
[hire]: https://cloudposse.com/contact/
238+
[slack]: https://slack.cloudposse.com/
239+
[linkedin]: https://www.linkedin.com/company/cloudposse
240+
[twitter]: https://twitter.com/cloudposse/
241+
[email]: mailto:hello@cloudposse.com
168242

169243

170244
### Contributors
171245

172-
| [![Erik Osterman][erik_img]][erik_web]<br/>[Erik Osterman][erik_web] | [![Andriy Knysh][andriy_img]][andriy_web]<br/>[Andriy Knysh][andriy_web] |
173-
|-------------------------------------------------------|------------------------------------------------------------------|
246+
| [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] |
247+
|---|
248+
249+
[aknysh_homepage]: https://github.com/aknysh
250+
[aknysh_avatar]: https://github.com/aknysh.png?size=150
251+
174252

175-
[erik_img]: http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144
176-
[erik_web]: https://github.com/osterman/
177-
[andriy_img]: https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144
178-
[andriy_web]: https://github.com/aknysh/

README.yaml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
#
3+
# This is the canonical configuration for the `README.md`
4+
# Run `make readme` to rebuild the `README.md`
5+
#
6+
7+
# Name of this project
8+
name: terraform-aws-tfstate-backend
9+
10+
# Logo for this project
11+
#logo: docs/logo.png
12+
13+
# License of this project
14+
license: "APACHE2"
15+
16+
# Canonical GitHub repo
17+
github_repo: cloudposse/terraform-aws-tfstate-backend
18+
19+
# Badges to display
20+
badges:
21+
- name: "Build Status"
22+
image: "https://travis-ci.org/cloudposse/terraform-aws-tfstate-backend.svg?branch=master"
23+
url: "https://travis-ci.org/cloudposse/terraform-aws-tfstate-backend"
24+
- name: "Latest Release"
25+
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-tfstate-backend.svg"
26+
url: "https://github.com/cloudposse/terraform-aws-tfstate-backend/releases/latest"
27+
- name: "Slack Community"
28+
image: "https://slack.cloudposse.com/badge.svg"
29+
url: "https://slack.cloudposse.com"
30+
31+
related:
32+
- name: "terraform-aws-dynamodb"
33+
description: "Terraform module that implements AWS DynamoDB with support for AutoScaling"
34+
url: "https://github.com/cloudposse/terraform-aws-dynamodb"
35+
- name: "terraform-aws-dynamodb-autoscaler"
36+
description: "Terraform module to provision DynamoDB autoscaler"
37+
url: "https://github.com/cloudposse/terraform-aws-dynamodb-autoscaler"
38+
39+
# Short description of this project
40+
description: |-
41+
Terraform module to provision an S3 bucket to store `terraform.tfstate` file and a DynamoDB table to lock the state file
42+
to prevent concurrent modifications and state corruption.
43+
44+
The module supports the following:
45+
46+
1. Forced server-side encryption at rest for the S3 bucket
47+
2. S3 bucket versioning to allow for Terraform state recovery in the case of accidental deletions and human errors
48+
3. State locking and consistency checking via DynamoDB table to prevent concurrent operations
49+
4. DynamoDB server-side encryption
50+
51+
https://www.terraform.io/docs/backends/types/s3.html
52+
53+
54+
__NOTE:__ The operators of the module (IAM Users) must have permissions to create S3 buckets and DynamoDB tables when performing `terraform plan` and `terraform apply`
55+
56+
# How to use this project
57+
usage: |-
58+
```hcl
59+
terraform {
60+
required_version = ">= 0.11.3"
61+
}
62+
63+
module "terraform_state_backend" {
64+
source = "git::https://github.com/cloudposse/terraform-aws-tfstate-backend.git?ref=master"
65+
namespace = "cp"
66+
stage = "prod"
67+
name = "terraform"
68+
attributes = ["state"]
69+
region = "us-east-1"
70+
}
71+
```
72+
73+
__NOTE:__ First create the bucket and table without any state enabled (Terraform will use the local file system to store state).
74+
You can then import the bucket and table by using [`terraform import`](https://www.terraform.io/docs/import/index.html) and store the state file into the bucket.
75+
76+
Once the bucket and table have been created, configure the [backend](https://www.terraform.io/docs/backends/types/s3.html)
77+
78+
```hcl
79+
terraform {
80+
required_version = ">= 0.11.3"
81+
82+
backend "s3" {
83+
region = "us-east-1"
84+
bucket = "< the name of the S3 bucket >"
85+
key = "terraform.tfstate"
86+
dynamodb_table = "< the name of the DynamoDB table >"
87+
encrypt = true
88+
}
89+
}
90+
91+
module "another_module" {
92+
source = "....."
93+
}
94+
```
95+
96+
Initialize the backend with `terraform init`.
97+
98+
After `terraform apply`, `terraform.tfstate` file will be stored in the bucket,
99+
and the DynamoDB table will be used to lock the state to prevent concurrent modifications.
100+
101+
<br/>
102+
103+
![s3-bucket-with-terraform-state](images/s3-bucket-with-terraform-state.png)
104+
105+
106+
include:
107+
- "docs/targets.md"
108+
- "docs/terraform.md"
109+
110+
# Contributors to this project
111+
contributors:
112+
- name: "Andriy Knysh"
113+
github: "aknysh"

docs/targets.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Makefile Targets
2+
```
3+
Available targets:
4+
5+
help This help screen
6+
help/all Display help for all targets
7+
lint Lint terraform code
8+
9+
```

0 commit comments

Comments
 (0)