Skip to content

Commit 66bbff2

Browse files
committed
Auto-generate docs for release v0.0.1 [ci skip]
1 parent 1d741ec commit 66bbff2

16 files changed

+282
-0
lines changed

LICENSE.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/LICENSE.txt>.
4+
If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!
5+
6+
Gruntwork License
7+
8+
Copyright (c) 2016 Gruntwork, LLC
9+
10+
This code is the property of Gruntwork, LLC. In the Software Development Agreement signed by both Gruntwork and your
11+
company, Gruntwork grants you a limited license to use, modify, and create derivative works of this code. Please
12+
consult the Software Development Agreement for the complete terms under which you may use this code.

README.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
**Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/README.md>.
4+
If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!
5+
6+
# Security Modules
7+
8+
This repo contains modules for setting up best practices for managing secrets, credentials, and servers:
9+
10+
* [kms-master-key](/modules/kms-master-key): This Terraform Module creates a new [Customer Master Key
11+
(CMK)](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys) in [Amazon's Key Management
12+
Service (KMS)](https://aws.amazon.com/kms/) as well as a [Key
13+
Policy](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key_permissions) that controls who has
14+
access to the CMK. You can use a CMK to encrypt and decrypt small amounts of data and to generate [Data
15+
Keys](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys) that can be used to encrypt and
16+
decrypt larger amounts of data.
17+
18+
Click on each module above to see its documentation. Head over to the [examples](/examples) folder for examples.
19+
20+
## What is a module?
21+
22+
At [Gruntwork](http://www.gruntwork.io), we've taken the thousands of hours we spent building infrastructure on AWS and
23+
condensed all that experience and code into pre-built **packages** or **modules**. Each module is a battle-tested,
24+
best-practices definition of a piece of infrastructure, such as a VPC, ECS cluster, or an Auto Scaling Group. Modules
25+
are versioned using [Semantic Versioning](http://semver.org/) to allow Gruntwork clients to keep up to date with the
26+
latest infrastructure best practices in a systematic way.
27+
28+
## How do you use a module?
29+
30+
Most of our modules contain either:
31+
32+
1. [Terraform](https://www.terraform.io/) code
33+
1. Scripts & binaries
34+
35+
#### Using a Terraform Module
36+
37+
To use a module in your Terraform templates, create a `module` resource and set its `source` field to the Git URL of
38+
this repo. You should also set the `ref` parameter so you're fixed to a specific version of this repo, as the `master`
39+
branch may have backwards incompatible changes (see [module
40+
sources](https://www.terraform.io/docs/modules/sources.html)).
41+
42+
For example, to use `v1.0.8` of the ecs-cluster module, you would add the following:
43+
44+
```hcl
45+
module "ecs_cluster" {
46+
source = "git::[email protected]:gruntwork-io/module-ecs.git//modules/ecs-cluster?ref=v1.0.8"
47+
48+
// set the parameters for the ECS cluster module
49+
}
50+
```
51+
52+
*Note: the double slash (`//`) is intentional and required. It's part of Terraform's Git syntax (see [module
53+
sources](https://www.terraform.io/docs/modules/sources.html)).*
54+
55+
See the module's documentation and `vars.tf` file for all the parameters you can set. Run `terraform get -update` to
56+
pull the latest version of this module from this repo before runnin gthe standard `terraform plan` and
57+
`terraform apply` commands.
58+
59+
#### Using scripts & binaries
60+
61+
You can install the scripts and binaries in the `modules` folder of any repo using the [Gruntwork
62+
Installer](https://github.com/gruntwork-io/gruntwork-installer). For example, if the scripts you want to install are
63+
in the `modules/ecs-scripts` folder of the https://github.com/gruntwork-io/module-ecs repo, you could install them
64+
as follows:
65+
66+
```bash
67+
gruntwork-install --module-name "ecs-scripts" --repo "https://github.com/gruntwork-io/module-ecs" --tag "0.0.1"
68+
```
69+
70+
See the docs for each script & binary for detailed instructions on how to use them.
71+
72+
## Developing a module
73+
74+
#### Versioning
75+
76+
We are following the principles of [Semantic Versioning](http://semver.org/). During initial development, the major
77+
version is to 0 (e.g., `0.x.y`), which indicates the code does not yet have a stable API. Once we hit `1.0.0`, we will
78+
follow these rules:
79+
80+
1. Increment the patch version for backwards-compatible bug fixes (e.g., `v1.0.8 -> v1.0.9`).
81+
2. Increment the minor version for new features that are backwards-compatible (e.g., `v1.0.8 -> 1.1.0`).
82+
3. Increment the major version for any backwards-incompatible changes (e.g. `1.0.8 -> 2.0.0`).
83+
84+
The version is defined using Git tags. Use GitHub to create a release, which will have the effect of adding a git tag.
85+
86+
#### Tests
87+
88+
See the [test](/test) folder for details.
89+
90+
## License
91+
92+
Please see [LICENSE.txt](/LICENSE.txt) for details on how the code in this repo is licensed.

circle.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/circle.yml>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

examples/kms-master-key/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
**Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/examples/kms-master-key/README.md>.
4+
If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!
5+
6+
# KMS Master Key Example
7+
8+
This is an example of how to create a [Customer Master
9+
Key (CMK)](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys) in [Amazon's Key Management
10+
Service (KMS)](https://aws.amazon.com/kms/) using the [kms-master-key module](/modules/kms-master-key). You can use a
11+
CMK to encrypt and decrypt small amounts of data and to generate [Data
12+
Keys](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys) that can be used to encrypt and
13+
decrypt larger amounts of data.
14+
15+
You can use KMS via the AWS API, CLI, or, for a more streamlined experience, you can use
16+
[gruntkms](https://github.com/gruntwork-io/gruntkms).
17+
18+
## Quick start
19+
20+
**Note**: These templates create a Master Key in KMS. Each Master Key costs $1/month, even if you delete it immediately
21+
after. So please be aware that applying this example will cost you money!
22+
23+
To try these templates out you must have Terraform installed (minimum version: `0.6.11`):
24+
25+
1. Open `vars.tf`, set the environment variables specified at the top of the file, and fill in any other variables that
26+
don't have a default.
27+
1. Run `terraform get`.
28+
1. Run `terraform plan`.
29+
1. If the plan looks good, run `terraform apply`.

examples/kms-master-key/main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/examples/kms-master-key/main.tf>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

examples/kms-master-key/outputs.tf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/examples/kms-master-key/outputs.tf>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

examples/kms-master-key/vars.tf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/examples/kms-master-key/vars.tf>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

modules/kms-master-key/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
**Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/modules/kms-master-key/README.md>.
4+
If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!
5+
6+
# KMS Master Key Module
7+
8+
This Terraform Module creates a new [Customer Master
9+
Key (CMK)](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys) in [Amazon's Key Management
10+
Service (KMS)](https://aws.amazon.com/kms/) as well as a [Key
11+
Policy](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key_permissions) that controls who has
12+
access to the CMK. You can use a CMK to encrypt and decrypt small amounts of data and to generate [Data
13+
Keys](http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys) that can be used to encrypt and
14+
decrypt larger amounts of data.
15+
16+
You can use KMS via the AWS API, CLI, or, for a more streamlined experience, you can use
17+
[gruntkms](https://github.com/gruntwork-io/gruntkms).
18+
19+
## How do you use this module?
20+
21+
* See the [root README](/README.md) for instructions on using Terraform modules.
22+
* See the [kms-master-key example](/examples/kms-master-key) for an example.
23+
* See [vars.tf](./vars.tf) for all the variables you can set on this module.
24+
25+
**Note**: This module creates a Master Key in KMS. Each Master Key costs $1/month, even if you delete it immediately
26+
after. So please be aware that using this module will cost you money!
27+
28+
## What is KMS?
29+
30+
[Amazon's Key Management Service (KMS)](https://aws.amazon.com/kms/) is a managed service that makes it easy for you to
31+
create and control the encryption keys used to encrypt your data, and uses Hardware Security Modules (HSMs) to protect
32+
the security of your keys.
33+
34+
## What is a Customer Master Key?
35+
36+
A Customer Master Key (CMK) is a secret key that KMS stores and manages for you. You can use the CMK to encrypt small
37+
amounts of data using the AWS APIs or a tool like [gruntkms](https://github.com/gruntwork-io/gruntkms). You can also use
38+
a CMK to generate a Data Key that you can use in your own encryption algorithms to encrypt and decrypt large amounts of
39+
data. You typically store the Data Key, encrypted via the CMK, in version control, and decrypt it via the AWS API or
40+
gruntkms whenever you need to use it to decrypt or encrypt data.

modules/kms-master-key/main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/modules/kms-master-key/main.tf>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

modules/kms-master-key/outputs.tf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/modules/kms-master-key/outputs.tf>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

modules/kms-master-key/vars.tf

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/modules/kms-master-key/vars.tf>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

test/README.md

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
**Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/test/README.md>.
4+
If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!
5+
6+
# Tests
7+
8+
This folder contains the tests for the modules in this repo.
9+
10+
## Running the tests locally
11+
12+
**Note #1**: Many of these tests create real resources in an AWS account. That means they cost money to run, especially
13+
if you don't clean up after yourself. Please be considerate of the resources you create and take extra care to clean
14+
everything up when you're done!
15+
16+
**Note #2**: Never hit `CTRL + C` or cancel a build once tests are running or the cleanup tasks won't run!
17+
18+
**Note #3**: We set `-timeout 45m` on all tests not because they necessarily take 45 minutes, but because Go has a
19+
default test timeout of 10 minutes, after which it does a `SIGQUIT`, preventing the tests from properly cleaning up
20+
after themselves. Therefore, we set a timeout of 45 minutes to make sure all tests have enough time to finish and
21+
cleanup.
22+
23+
#### Prerequisites
24+
25+
- Install the latest version of [Go](https://golang.org/).
26+
- Install [glide](https://glide.sh/) for Go dependency management. On OSX, the simplest way to install is
27+
`brew update; brew install glide`.
28+
- Install [Terraform](https://www.terraform.io/downloads.html).
29+
- Add your AWS credentials as environment variables: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`
30+
- For some of the tests, you also need to set the `GITHUB_OAUTH_TOKEN` environment variable to a valid GitHub
31+
auth token with "repo" access. You can generate one here: https://github.com/settings/tokens
32+
33+
#### Setup
34+
35+
Download Go dependencies using glide:
36+
37+
```
38+
cd test
39+
glide update
40+
```
41+
42+
#### Run all the tests
43+
44+
```bash
45+
cd test
46+
go test -v -timeout 45m -parallel 128
47+
```
48+
49+
**Note**: The automated test for the `kms-master-key` package is disabled by default. That's because generating a KMS
50+
Master Key costs $1/month, even if we delete it right after, which can add up quickly if we run this test often. To
51+
enable the test, you need to set the `RUN_KMS_TEST` environment variable:
52+
53+
```bash
54+
cd test
55+
RUN_KMS_TEST=true go test -v -timeout 45m -parallel 128
56+
```
57+
58+
#### Run a specific test
59+
60+
To run a specific test called `TestFoo`:
61+
62+
```bash
63+
cd test
64+
go test -v -timeout 45m -parallel 128 -run TestFoo
65+
```

test/glide.lock

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/glide.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
# We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
# If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/test/glide.yaml>.
4+
# If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

test/kms_master_key_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
// We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
// If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/test/kms_master_key_test.go>.
4+
// If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

test/test_helpers.go

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// **Note**: This public repo contains the documentation for the private GitHub repo <https://github.com/gruntwork-io/module-security>.
2+
// We publish the documentation publicly so it turns up in online searches, but to see the source code, you must be a Gruntwork customer.
3+
// If you're already a Gruntwork customer, the original source for this file is at: <https://github.com/gruntwork-io/module-security/blob/master/test/test_helpers.go>.
4+
// If you're not a customer, contact us at <[email protected]> or <http://www.gruntwork.io> for info on how to get access!

0 commit comments

Comments
 (0)