|
1 |
| -# dev.cloudposse.co |
2 |
| -Example Terraform Reference Architecture for Geodesic Module Development Sandbox Organization in AWS. |
| 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 | +[](https://cloudposse.com) |
| 4 | + |
| 5 | +# dev.cloudposse.co [](https://g.codefresh.io/pipelines/dev.cloudposse.co/builds) [](https://github.com/cloudposse/dev.cloudposse.co/releases) [](https://slack.cloudposse.com) |
| 6 | + |
| 7 | + |
| 8 | +Terraform/Kubernetes Reference Infrastructure for Cloud Posse Development Sandbox Organization in AWS. |
| 9 | + |
| 10 | +This account is intended for developers to provision and test their own AWS infrastructure. |
| 11 | + |
| 12 | +__NOTE:__ Before creating the Development infrastructure, you need to provision the [Parent ("Root") Organization](https://github.com/cloudposse/root.cloudposse.co) in AWS (because it creates resources needed for all other accounts). Follow the steps in [README](https://github.com/cloudposse/root.cloudposse.co) first. You need to do it only once. |
| 13 | + |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps. |
| 18 | + |
| 19 | + |
| 20 | +It's 100% Open Source and licensed under the [APACHE2](LICENSE). |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +## Introduction |
| 31 | + |
| 32 | +We use [geodesic](https://github.com/cloudposse/geodesic) to define and build world-class cloud infrastructures backed by AWS and powered by Kubernetes. |
| 33 | + |
| 34 | +`geodesic` exposes many tools that can be used to define and provision AWS and Kubernetes resources. |
| 35 | + |
| 36 | +Here is the list of tools we use to provision the `dev.cloudposse.co` infrastructure: |
| 37 | + |
| 38 | +* [aws-vault](https://github.com/99designs/aws-vault) |
| 39 | +* [chamber](https://github.com/segmentio/chamber) |
| 40 | +* [terraform](https://www.terraform.io/) |
| 41 | + |
| 42 | + |
| 43 | +## Quick Start |
| 44 | + |
| 45 | + |
| 46 | +### Setup AWS Role |
| 47 | + |
| 48 | +__NOTE:__ You need to do it only once. |
| 49 | + |
| 50 | +Configure AWS profile in `~/.aws/config`. Make sure to change username ( [email protected]) to your own. |
| 51 | + |
| 52 | +```bash |
| 53 | +[profile cpco-dev-admin] |
| 54 | +region=us-west-2 |
| 55 | +role_arn=arn:aws:iam::590638247571:role/OrganizationAccountAccessRole |
| 56 | +mfa_serial=arn:aws:iam::681280261279:mfa/ [email protected] |
| 57 | +source_profile=cpco |
| 58 | +``` |
| 59 | + |
| 60 | +### Install and setup aws-vault |
| 61 | + |
| 62 | +__NOTE:__ You need to do it only once. |
| 63 | + |
| 64 | +We use [aws-vault](https://docs.cloudposse.com/tools/aws-vault/) to store IAM credentials in your operating system's secure keystore and then generates temporary credentials from those to expose to your shell and applications. |
| 65 | + |
| 66 | +Install [aws-vault](https://docs.cloudposse.com/tools/aws-vault/) on your local computer first. |
| 67 | + |
| 68 | +On MacOS, you may use `homebrew cask` |
| 69 | + |
| 70 | +```bash |
| 71 | +brew cask install aws-vault |
| 72 | +``` |
| 73 | + |
| 74 | +Then setup your secret credentials for AWS in `aws-vault` |
| 75 | +```bash |
| 76 | +aws-vault add --backend file cpco |
| 77 | +``` |
| 78 | + |
| 79 | +__NOTE:__ You should set `AWS_VAULT_BACKEND=file` in your shell rc config (e.g. `~/.bashrc`) so it persists. |
| 80 | + |
| 81 | +For more info, see [aws-vault](https://docs.cloudposse.com/tools/aws-vault/) |
| 82 | + |
| 83 | + |
| 84 | +## Examples |
| 85 | + |
| 86 | +### Build Docker Image |
| 87 | + |
| 88 | +``` |
| 89 | +# Initialize the project's build-harness |
| 90 | +make init |
| 91 | +
|
| 92 | +# Build docker image |
| 93 | +make docker/build |
| 94 | +``` |
| 95 | + |
| 96 | +### Install the wrapper shell |
| 97 | +```bash |
| 98 | +make install |
| 99 | +``` |
| 100 | + |
| 101 | +### Run the shell |
| 102 | +```bash |
| 103 | +dev.cloudposse.co |
| 104 | +``` |
| 105 | + |
| 106 | +### Login to AWS with your MFA device |
| 107 | +```bash |
| 108 | +assume-role |
| 109 | +``` |
| 110 | + |
| 111 | +__NOTE:__ Before provisioning AWS resources with Terraform, you need to create `tfstate-backend` first (S3 bucket to store Terraform state and DynamoDB table for state locking). |
| 112 | + |
| 113 | +Follow the steps in this [README](https://github.com/cloudposse/terraform-root-modules/blob/master/aws/tfstate-backend/). You need to do it only once. |
| 114 | + |
| 115 | +After `tfstate-backend` has been provisioned, follow the rest of the instructions in the order shown below. |
| 116 | + |
| 117 | + |
| 118 | +### Provision `dns` with Terraform |
| 119 | + |
| 120 | +Change directory to `dns` folder |
| 121 | +```bash |
| 122 | +cd /conf/dns |
| 123 | +``` |
| 124 | + |
| 125 | +Run Terraform |
| 126 | +```bash |
| 127 | +init-terraform |
| 128 | +terraform plan |
| 129 | +terraform apply |
| 130 | +``` |
| 131 | + |
| 132 | +For more info, see [geodesic-with-terraform](https://docs.cloudposse.com/geodesic/module/with-terraform/) |
| 133 | + |
| 134 | +### Provision `cloudtrail` with Terraform |
| 135 | + |
| 136 | +```bash |
| 137 | +cd /conf/cloudtrail |
| 138 | +init-terraform |
| 139 | +terraform plan |
| 140 | +terraform apply |
| 141 | +``` |
| 142 | + |
| 143 | + |
| 144 | + |
0 commit comments