|
| 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. |
0 commit comments