Skip to content

Commit 8238391

Browse files
committed
docs(readme): update for accuracy and partner adoption
- Fix module source references to reflect git branch usage - Clarify helper script purposes (setup.sh vs deploy.sh) - Add "Before You Begin" prerequisites checklist - Add Quick Start section with 10-minute deployment guide - Add Troubleshooting section with common issues and solutions - Fix broken link in Terraform Commands section - Improve formatting with tables and code blocks
1 parent 70114ef commit 8238391

File tree

1 file changed

+109
-31
lines changed

1 file changed

+109
-31
lines changed

README.md

Lines changed: 109 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,28 @@ _**Note**_: Engineers *must* have access and permissions to create AWS resources
118118
- Terraform Documentation: The official Terraform documentation is an exhaustive resource that covers everything from installation to advanced topics. https://developer.hashicorp.com/terraform/docs
119119
- Terraform/AWS Intro: HashiCorp provides an official tutorial that covers the basics of Terraform and helps you get started with deploying infrastructure into AWS. https://developer.hashicorp.com/terraform/tutorials/aws-get-started
120120
- Terraform AWS Provider Documentation: If you're using Terraform with AWS, this documentation provides detailed information on the available resources and data sources. https://registry.terraform.io/providers/hashicorp/aws/latest/docs
121-
- Terraform module published by the dibbs-ecr-viewer DevOps teams this repo uses: https://registry.terraform.io/modules/CDCgov/dibbs-ecr-viewer/aws/latest
121+
- Terraform module (git source): The ECS module is sourced directly from the [terraform-aws-dibbs-ecr-viewer repository](https://github.com/CDCgov/terraform-aws-dibbs-ecr-viewer). See Section 4.3 for details on current module sources.
122122

123123
[Return to Table of Contents](#table-of-contents)
124124

125125
## 4.2 Helper Scripts
126126

127127
**If you are familiar with terraform, have setup a backend, understand terraform deployment workflows, know how to validate terraform, or are otherwise opinionated about how you want to run things, feel free to skip this section**
128-
- We have several helper scripts that will assist you with setting up your AWS backend and deploying your AWS resources.
128+
- We have several helper scripts that will assist you with setting up your AWS backend and deploying your AWS resources.
129129
- These scripts are located in the **terraform/utilities** folder, the **terraform/implementation/setup** folder and the **terraform/implementation/ecs** folder.
130-
- The **utilities** folder contains scripts that will assist in generating terraform docs, formatting and linting terraform code.
131-
- The **setup.sh** script will assist you with creating the terraform state and .env files to be used later, also sets up OIDC for your GitHub workflows.
132-
- The **deploy.sh** script will assist you with deploying your ECS module from your development machine.
130+
131+
| Folder | Purpose |
132+
|--------|---------|
133+
| `terraform/utilities` | Scripts for generating terraform docs, formatting and linting code |
134+
| `terraform/implementation/setup` | Creates the terraform backend (S3 state bucket, DynamoDB lock table) and OIDC configuration |
135+
| `terraform/implementation/ecs` | Deploys the ECS module (eCR Viewer application infrastructure) |
136+
137+
- The **setup.sh** script creates the terraform state backend and .env files. It also sets up OIDC for GitHub workflows.
138+
- The **deploy.sh** script deploys your ECS module from your development machine.
133139

134140
_**Note**_: It is not recommended to run these scripts without reviewing them and understanding their limitations.
135141

136-
_**Note**_: It is not recommended to use these scripts to automate your terraform deployments, please see the [GitHub workflows](https://github.com/CDCgov/dibbs-aws/tree/main/.github/workflows) for examples on how to do that.
142+
_**Note**_: It is not recommended to use these scripts to automate your terraform deployments. Please see the [GitHub workflows](https://github.com/CDCgov/dibbs-aws/tree/main/.github/workflows) for examples of CI/CD deployment.
137143

138144
**Terraform validation and docs with `./utils.sh`**
139145
* In your terminal, navigate to the _/terraform/utilities_ folder.
@@ -154,28 +160,45 @@ The `setup.sh` scripts will assist you with creating the terraform state and tfv
154160

155161
The setup.sh script will create the following files:
156162

157-
- _tfstate.tfvars_
158-
- _.env_
159-
- _terraform.state_
163+
- _tfstate.tfvars_ - Terraform variables for the state backend configuration
164+
- _.env_ - Environment variables used by deployment scripts
165+
- _terraform.state_ - Local terraform state file (if using local backend)
166+
167+
**Deploy Your ECS Module with `./deploy.sh`**
168+
169+
It is highly recommended to create a new directory per environment that is launched. To do so, run:
170+
```bash
171+
cp -r terraform/implementation/ecs terraform/implementation/<ENVIRONMENT_NAME>
172+
```
173+
The benefits of doing this reduce the likelihood of conflicts and allow each environment to run different versions of the same module.
174+
175+
To deploy your ECS Module from your local machine:
176+
177+
1. Navigate to your working directory:
178+
```bash
179+
cd terraform/implementation/ecs/
180+
# or for a custom environment:
181+
cd terraform/implementation/<ENVIRONMENT_NAME>
182+
```
183+
184+
2. Run the deploy script for your designated environment:
185+
```bash
186+
./deploy.sh -e <ENVIRONMENT>
187+
```
160188

161-
**Deploy Your ECS Module with `./deploy`**
162-
* It is highly recommended to create a new directory per environment that is launched, to do so run `cp terraform/implementation/ecs terraform/implementation/<ENVIRONMENT>`.
163-
* The benefits of doing this reduces the likelyhood of conflicts and allows each environment to run different versions of the same module.
164-
* To run your ECS Module Changes in your local terminal, navigate to your working directory, ` cd terraform/implementation/ecs/` or `cd terraform/implementation/<ENVIRONMENT>`
165-
* In your terminal run the deploy script for your designated environment `./deploy.sh -e <ENVIRONMENT>`.
189+
_**Note**_: The `-e` flag specifies the environment (e.g., `dev`, `test`, `prod`). This can match your `<ENVIRONMENT_NAME>` directory naming convention, or be any environment name your team desires.
166190

167-
_**Note**_: The _-e_ tag stands for environment and you can specify `dev`, `test`, `prod`, this can match your `<ENVIRONMENT>` naming convention.
168-
or whatever environment your team desires.
191+
For non-interactive deployments, ensure you have a `.env` file with the required variables before running deploy.sh. See the [setup.sh](https://github.com/CDCgov/dibbs-aws/blob/main/terraform/implementation/setup/setup.sh) script for the expected format.
169192

170193
- [Return to Table of Contents](#table-of-contents)
171194

172195
## 4.3 Modules used in this repository
173196

174-
**Modules pulled from the Terraform Registry**
175-
- [terraform-aws-dibbs-ecr-viewer](https://registry.terraform.io/modules/CDCgov/dibbs-ecr-viewer/aws/latest) - This module is used to deploy the eCR Viewer application to AWS.
176-
- [vpc](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest) - This module is used to deploy the VPC for the ECS module.
197+
**Remote sources:**
198+
- [terraform-aws-dibbs-ecr-viewer](https://github.com/CDCgov/terraform-aws-dibbs-ecr-viewer) - This module deploys the eCR Viewer application to AWS. Currently using git source: `git::https://github.com/CDCgov/terraform-aws-dibbs-ecr-viewer.git?ref=alis/feature/checkov-workflow`. See the [ECS module README](./terraform/implementation/ecs/README.md) for detailed configuration options.
199+
- [terraform-aws-modules/vpc/aws](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest) - This module provisions the VPC infrastructure for the ECS module.
177200

178-
**Local modules**
201+
**Local modules:**
179202
- [oidc](./terraform/modules/oidc/README.md) - OIDC module, used to setup OIDC for GitHub workflows
180203
- [tfstate](./terraform/modules/tfstate/README.md) - TFState module, used to setup the terraform state backend and lock table
181204
- [db](./terraform/modules/db/README.md) - Database module, used to setup the database for the ECS module
@@ -185,17 +208,72 @@ or whatever environment your team desires.
185208
**Use the dibbs-aws repository**
186209

187210
1. Select to create your own repo from this template, or fork it to your own repository.
188-
1. Clone the repository to your local machine.
189-
2. Make a new branch for your changes: `git checkout -b <BRANCH>`.
190-
3. Make any changes required by your team to the terraform configurations.
191-
4. Add and commit changes to your working branch: `git add . && git commit -m "Your message here"`.
192-
5. Push your changes to your github repository: `git push origin <BRANCH>`.
193-
6. Open a Pull Request so that your team can review your changes and testing can be done.
194-
7. Go back to step 4 until your changes are approved.
195-
8. Once your changes are approved, merge your changes into the main branch.
211+
2. Clone the repository to your local machine.
212+
3. Make a new branch for your changes: `git checkout -b <BRANCH>`.
213+
4. Make any changes required by your team to the terraform configurations.
214+
5. Add and commit changes to your working branch: `git add . && git commit -m "Your message here"`.
215+
6. Push your changes to your github repository: `git push origin <BRANCH>`.
216+
7. Open a Pull Request so that your team can review your changes and testing can be done.
217+
8. Go back to step 4 until your changes are approved.
218+
9. Once your changes are approved, merge your changes into the main branch.
196219

197-
**Terrform Commands**
220+
**Terraform Commands**
198221

199-
- Please review these docs for specific help understanding and running terraform commands: [Terraform Commands](#41-requirements)
222+
For help with terraform commands, please visit the [official Terraform documentation](https://developer.hashicorp.com/terraform/tutorials/aws-get-started).
200223

201-
- [Return to Table of Contents](#table-of-contents)
224+
[Return to Table of Contents](#table-of-contents)
225+
226+
---
227+
228+
## Before You Begin
229+
230+
Ensure you have the following prerequisites before deploying:
231+
232+
- **AWS Account** with permissions for IAM, VPC, ECS, RDS, S3, DynamoDB, ACM, and Route 53
233+
- **Terraform** version 1.0.0+ installed locally
234+
- **AWS CLI** version 2+ configured with appropriate credentials
235+
- **GitHub repository** (for OIDC configuration if using CI/CD)
236+
- **SSL certificate** in AWS Certificate Manager (ACM) for your domain
237+
- **Route 53 hosted zone ID** (if using a custom domain)
238+
- For non-integrated auth: OAuth application credentials from your provider
239+
240+
---
241+
242+
## Quick Start
243+
244+
Get started deploying this infrastructure in under 10 minutes:
245+
246+
```bash
247+
# Clone the repository
248+
git clone https://github.com/CDCgov/dibbs-aws.git
249+
cd dibbs-aws
250+
251+
# Step 1: Set up your AWS backend (one-time)
252+
cd terraform/implementation/setup
253+
./setup.sh
254+
255+
# Step 2: Configure and deploy ECS
256+
cd ../ecs
257+
cp -r . ../my-environment # Optional: create environment-specific copy
258+
cd ../my-environment
259+
./deploy.sh -e dev
260+
```
261+
262+
For detailed step-by-step instructions, see [Section 4.2 Helper Scripts](#42-helper-scripts).
263+
264+
---
265+
266+
## Common Issues and Solutions
267+
268+
| Issue | Solution |
269+
|-------|----------|
270+
| Backend not initialized error | Run `setup.sh` first to initialize the S3 backend before deploying ECS |
271+
| OIDC token errors | Verify your GitHub repository name matches exactly (format: `org/repo`) and the OIDC role trust policy is configured correctly |
272+
| Database connection fails | Check that security group rules allow traffic from ECS task subnet to RDS, and that the database type in `tfvars` matches your configuration |
273+
| SSL certificate errors | Ensure the cert is issued by ACM (not imported) and in the same region as your deployment (typically `us-east-1` for ALB) |
274+
| Permission denied on scripts | Run `chmod +x terraform/implementation/setup/setup.sh` and `chmod +x terraform/implementation/ecs/deploy.sh` |
275+
| State lock error | Wait for any existing Terraform operations to complete, or remove the `.terraform.lock.hcl` file if stale |
276+
277+
---
278+
279+
[Return to Table of Contents](#table-of-contents)

0 commit comments

Comments
 (0)