Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation to clarify support for multiple AWS accounts and multiple applications #589

Draft
wants to merge 91 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
0a15153
Add documentation for multiple AWS accounts
rocketnova Apr 25, 2024
6931f1e
Reword for multiple AWS accounts
rocketnova Apr 25, 2024
d58024f
Fix typos
rocketnova Apr 25, 2024
1dfb115
Add documentation for configuring apps
rocketnova Apr 25, 2024
c75a43d
Make READMEs less circular
rocketnova Apr 25, 2024
f9fe792
Remove brittle next step
rocketnova Apr 25, 2024
87bd8dd
Fix headings and use consistent prereq terminology
rocketnova Apr 25, 2024
ce9ff9e
Use consistent prereq terminology
rocketnova Apr 25, 2024
594dee0
Fix link name
rocketnova Apr 25, 2024
ba38e6a
Make markdown list notation consistent
rocketnova Apr 25, 2024
392f5c3
Add high level notes on what the doc covers
rocketnova Apr 25, 2024
fc5b686
Change instruction format
rocketnova Apr 25, 2024
42c1a97
Modify network instructions
rocketnova Apr 25, 2024
352193c
Start working on network docs
rocketnova Apr 25, 2024
e329a98
Modify network docs. Make custom domains actually optional.
rocketnova Apr 25, 2024
83ceda9
WIP
rocketnova Apr 25, 2024
705dacf
Wordsmith
rocketnova Apr 25, 2024
28286fa
WIP
rocketnova Apr 26, 2024
6210dac
Fix set-up-networks plural
rocketnova Apr 26, 2024
da50ed2
WIP
rocketnova Apr 26, 2024
6396ff4
Continue to refine multi-* language
rocketnova Apr 26, 2024
4ea13f1
Rework build repository docs
rocketnova Apr 26, 2024
39a8023
Address app-service
rocketnova Apr 26, 2024
27b3c87
Work on monitoring
rocketnova Apr 26, 2024
162799c
Work on custom domains
rocketnova Apr 26, 2024
e4e196b
Adjust indentation
rocketnova Apr 26, 2024
3d1ca31
Wordsmith
rocketnova Apr 30, 2024
eee2a24
Add more clarity
rocketnova Apr 30, 2024
b28fea5
Consistency
rocketnova Apr 30, 2024
a397335
Consistency
rocketnova Apr 30, 2024
ab98d66
Consistency. Clarity
rocketnova Apr 30, 2024
1604742
Fix typo
rocketnova Apr 30, 2024
c460330
Clarify
rocketnova Apr 30, 2024
082ffd9
Clarity
rocketnova Apr 30, 2024
96af1c5
Fix typo
rocketnova Apr 30, 2024
e6316ac
Clarity
rocketnova Apr 30, 2024
f92c48a
Wrong syntax
rocketnova Apr 30, 2024
36248f4
Rename for consistency
rocketnova Apr 30, 2024
c4fd3a8
Fix typos
rocketnova Apr 30, 2024
f3061c8
Update network docs
rocketnova Apr 30, 2024
aea6984
Update CI/CD
rocketnova Apr 30, 2024
4b58d92
Add docs and script for installing multiple apps
rocketnova May 2, 2024
a3496fb
Add script comments
rocketnova May 2, 2024
73b076c
Suppress script verbosity
rocketnova May 2, 2024
aa1b3d4
Link to new docs
rocketnova May 2, 2024
6263e12
Update update-template.sh
rocketnova May 3, 2024
8f3ec62
Add WIP
rocketnova May 3, 2024
9f64936
WIP update
rocketnova May 3, 2024
070ac8f
Fix target types
rocketnova May 4, 2024
08917f5
Add more documentation
rocketnova May 4, 2024
831ed9e
Refactor. Update docs
rocketnova May 4, 2024
f8f8c28
Remove feature flag infra changes
rocketnova May 7, 2024
b2a7d06
Remove network infra changes
rocketnova May 7, 2024
ec0d699
Improve technical writing
rocketnova May 7, 2024
f74f890
Improve technical writing
rocketnova May 7, 2024
12ed368
Improve technical writing
rocketnova May 7, 2024
ddf9324
Improve technical writing
rocketnova May 7, 2024
b72f33f
Improve technical writing
rocketnova May 7, 2024
70afcb3
Improve technical writing
rocketnova May 7, 2024
84662b9
Improve technical writing
rocketnova May 7, 2024
d0463bc
Improve technical writing
rocketnova May 7, 2024
24d12f6
Improve technical writing
rocketnova May 7, 2024
2bf687d
Consistently capitalize 'Terraform'
rocketnova May 7, 2024
fc1d704
Make setup lists and prereq lists consistent
rocketnova May 7, 2024
7fe9315
Improve technical writing
rocketnova May 7, 2024
fa18d90
Improve technical writing
rocketnova May 7, 2024
4ba3e60
Improve technical writing
rocketnova May 7, 2024
3341ed4
Improve technical writing
rocketnova May 7, 2024
7bbe2d1
Improve technical writing
rocketnova May 7, 2024
460aac5
Improve technical writing
rocketnova May 7, 2024
bf5466e
Improve technical writing
rocketnova May 7, 2024
5c3f37d
Improve technical writing
rocketnova May 7, 2024
156ff85
Improve technical writing
rocketnova May 7, 2024
ea81834
Improve technical writing
rocketnova May 7, 2024
44486a1
Improve technical writing
rocketnova May 7, 2024
a820bf5
Improve technical writing
rocketnova May 7, 2024
98df1cb
Improve technical writing
rocketnova May 7, 2024
e4aadc5
Use relative links
rocketnova May 7, 2024
1c263f6
Fix prereq
rocketnova May 7, 2024
8310979
Add stronger warnings
rocketnova May 7, 2024
754621d
Add link to release notes
rocketnova May 7, 2024
a6691b2
Add missing documentation
rocketnova May 7, 2024
d0ee3a3
Merge branch 'main' into rocket/multi-app
rocketnova May 8, 2024
c836634
Consistency
rocketnova May 8, 2024
5fd5b3b
Address shellcheck
rocketnova May 16, 2024
63d57c1
Alternate app update to avoid no-index where possible
rocketnova May 16, 2024
2d6c3e7
Address shellcheck
rocketnova May 16, 2024
9003c84
Update template-only CI/CD
rocketnova May 16, 2024
8ec917a
Move auth with AWS into prereqs instead of step 1
rocketnova May 16, 2024
0b2170a
Merge branch 'main' into rocket/multi-app
rocketnova May 16, 2024
71f2cd4
Update command execution docs for consistency
rocketnova May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve technical writing
rocketnova committed May 7, 2024
commit 84662b9ae9c75116c05b39b867e9327644540777
100 changes: 48 additions & 52 deletions docs/infra/set-up-infrastructure-tools.md
Original file line number Diff line number Diff line change
@@ -1,95 +1,91 @@
# Set up infrastructure developer tools

If you are working on the infrastructure, you will need to complete these setup steps.
To work on the infrastructure, complete these steps.

## Prerequisites
## Instructions

### Install Terraform

[Terraform](https://www.terraform.io/) is an infrastructure as code (IaC) tool that allows you to build, change, and version infrastructure safely and efficiently. This includes both low-level components like compute instances, storage, and networking, as well as high-level components like DNS entries and SaaS features.
[Terraform](https://www.terraform.io/) is an infrastructure as code (IaC) tool that allows you to build, change, and version infrastructure safely and efficiently. This includes both low-level components, like compute instances, storage, and networking, as well as high-level components, like DNS entries and Software-as-a-Service (SaaS) features.

You may need different versions of Terraform since different projects may require different versions of Terraform. The best way to manage Terraform versions is with [Terraform Version Manager (tfenv)](https://github.com/tfutils/tfenv).
You may need to install different versions of Terraform on your machine because different projects may require different versions of Terraform. The best way to manage Terraform versions is with [Terraform Version Manager (tfenv)](https://github.com/tfutils/tfenv).

To install via [Homebrew](https://brew.sh/)
Follow these steps to set up tfenv:

```bash
brew install tfenv
```

Then install the version of Terraform you need.

```bash
tfenv install 1.4.6
```
1. Use [Homebrew](https://brew.sh/) to install tfenv:
```bash
brew install tfenv
```
2. Install the version of Terraform you need:
```bash
tfenv install 1.4.6
```

If you are unfamiliar with Terraform, check out this [basic introduction to Terraform](./intro-to-terraform.md).

### Install AWS CLI

The [AWS Command Line Interface (AWS CLI)](https://aws.amazon.com/cli/) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts. Install the AWS commmand line tool by following the instructions found here:
The [AWS Command Line Interface (AWS CLI)](https://aws.amazon.com/cli/) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

- [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
Install the AWS CLI by following the [AWS installation instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).

### Install Go

The [Go programming language](https://go.dev/dl/) is required to run [Terratest](https://terratest.gruntwork.io/), the unit test framework for Terraform.

Use Homebrew to install go:

```bash
brew install golang
```

### Install GitHub CLI

The [GitHub CLI](https://cli.github.com/) is useful for automating certain operations for GitHub such as with GitHub actions. This is needed to run [check-github-actions-auth.sh](/bin/check-github-actions-auth.sh)
The [GitHub CLI](https://cli.github.com/) is useful for automating certain operations on GitHub, such as GitHub actions. For example, you need the Github CLI to run [check-github-actions-auth.sh](/bin/check-github-actions-auth.sh).

Use Homebrew to install the GitHub CLI:

```bash
brew install gh
```

### Install linters

We have several optional utilities for running infrastructure linters locally. These are run as part of the CI pipeline, therefore, it is often simpler to test them locally first.
The following linters are run as part of the CI pipeline:

* [Shellcheck](https://github.com/koalaman/shellcheck)
* [actionlint](https://github.com/rhysd/actionlint)
* [markdown-link-check](https://github.com/tcort/markdown-link-check)

To install and run them locally, run:

```bash
brew install shellcheck
brew install actionlint
make infra-lint
```

## AWS Authentication

In order for Terraform to authenticate with your accounts you will need to configure your aws credentials using the AWS CLI or manually create your config and credentials file. If you need to manage multiple credentials or create named profiles for use with different environments you can add the `--profile` option.

There are multiple ways to authenticate, but we recommend creating a separate profile for your project in your AWS credentials file, and setting your local environment variable `AWS_PROFILE` to the profile name. We recommend using [direnv](https://direnv.net/) to manage local environment variables.
**Credentials should be located in ~/.aws/credentials** (Linux & Mac) or **%USERPROFILE%\.aws\credentials** (Windows)

### Examples

```bash
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-2
Default output format [None]: json
```

**Using the above command will create a [default] profile.**

```bash
$ aws configure --profile dev
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-2
Default output format [None]: json
```

**Using the above command will create a [dev] profile.**

Once you're done, verify access by running the following command to print out information about the AWS IAM user you authenticated as.

```bash
aws sts get-caller-identity
```
### Authenticate with AWS

To use terraform with your AWS accounts, you must configure your AWS credentials. There are multiple ways to authenticate with AWS, but we recommend the following process:

1. Use the AWS CLI command `aws configure --profile <PROFILE_NAME>` to create a separate profile for each AWS account. `aws configure` will store your credentials in ~/.aws/credentials** (Linux & Mac) or **%USERPROFILE%\.aws\credentials** (Windows). For example, to create a profile named `my-aws-account`, run:
```bash
$ aws configure --profile my-aws-account
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-2
Default output format [None]: json
```
2. Set the local environment variable `AWS_PROFILE` to the profile name. For example, to set the `AWS_PROFILE` environment variable to `my-aws-account`, run:
```bash
export AWS_PROFILE=my-aws-account
```
3. (Optional) Use the [direnv](https://direnv.net/) to manage local environment variables. Instead of directly exporting environment variables on your machine, allow direnv to automatically set environment variables depending on the directory you are working in.
4. Verify access by running the following command. It should print out the profile name you set in Step 1.
```bash
aws sts get-caller-identity
```

### References

6 changes: 3 additions & 3 deletions infra/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Overview

This project practices infrastructure-as-code and uses the [Terraform framework](https://www.terraform.io). This directory contains the infrastructure code for this project, including infrastructure for all application resources. This terraform project uses the [AWS provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs).
This project practices infrastructure-as-code (IaC) and uses the [Terraform framework](https://www.terraform.io). This directory contains the infrastructure code for this project, including infrastructure for all application resources. This terraform project uses the [AWS provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs).

## 📂 Directory structure

The directory structure looks like this:

```text
infra/ Infrastructure code
accounts/ [Root module] IaC and IAM resources
accounts/ [Root module] IaC and Identity Access Management (IAM) resources
[APP_NAME]/ Application directory: infrastructure for the [APP_NAME] application
modules/ Reusable child modules
networks/ [Root module] Account level network config (shared across all apps, environments, and terraform workspaces)
@@ -18,7 +18,7 @@ Each application directory contains the following:

```text
app-config/ Application-level configuration for the application resources (different config for different environments)
build-repository/ [Root module] Docker image repository for the application (shared across environments and terraform workspaces)
build-repository/ [Root module] Container image repository for the application (shared across environments and terraform workspaces)
database/ [Root module] Configuration for database (different config for different environments)
service/ [Root module] Configuration for containers, such as load balancer, application service (different config for different environments)
```