Skip to content

Commit 307efdd

Browse files
Update readme
1 parent 5068fe2 commit 307efdd

File tree

4 files changed

+57
-95
lines changed

4 files changed

+57
-95
lines changed
File renamed without changes.
Binary file not shown.

infrastructure/README.md

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,72 @@
1-
# Terraform ECS Postgres App
1+
# NPD Infrastructure
22

3-
Terraform configuration for provisioning the NPD AWS infrastructure. This will be added to as we build out more of the infrastructure. To read more about Terraform for AWS and explore a "Getting Started Guide," go [here](https://developer.hashicorp.com/terraform/tutorials/aws-get-started).
3+
## Infrastructure Diagram
44

5-
## Dependencies
5+
![NPD Infrastructure.drawio.png](NPD%20Infrastructure.drawio.png)
66

7-
* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
8-
* [Terraform CLI](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)
9-
* [CTKey CLI Tool](https://cloud.cms.gov/getting-started-access-key-cli-tool) (n.b. ensure you add CTKey to PATH)
7+
## Update Cadence
108

9+
- `sandbox` will be updated whenever `main` is updated until it is torn down
10+
- The `dev` environment is to be updated whenever updates to `main` are merged
11+
- `test` / `uat` is updated whenever a release is cut
12+
- Releasing to `prod` is manual, requires sign-off from the PM and eng team
1113

12-
## Setup
14+
## Naming Conventions
1315

14-
### Authentication
15-
Follow these setup steps to set and/or refresh your stored AWS credentials for this project.
16-
1. Update the variables in `ctkey.sh` to match your application and AWS account.
17-
* Ensure that the IAM role aligns with a role you have access to (may be ct-ado-dsac-developer-admin instead of ct-ado-dsac-application-admin, depending on how your AWS perms were provisioned)
18-
2. Run `./ctkey.sh`
19-
3. Set the AWS_PROFILE environment variable with the profile name you chose
16+
The naming scheme for resources should be consistent but not too verbose.
17+
Sandbox resources do not follow a consistent naming scheme.
2018

21-
### Provision Resources
22-
1. Create a `terraform.tfvars` file to pass custom values for the variables contained in `variables.tf`
23-
2. Run
19+
`{project-name}-${region}-${tier}-${description}-${index?}`
2420

25-
```sh
26-
terraform init
27-
terraform apply
28-
```
29-
30-
Provisions the following:
21+
Non-prod is divided into two tiers:
22+
- `dev`
23+
- `test`
3124

32-
- ECS cluster, service, and task definitions
33-
- ECR repository to publish custom container images to
34-
- ALB to direct traffic to ECS on port 80
35-
- RDS database with public connectivity to 5432 (**for local dev, be careful**). Note: Refer to AWS Secrets Manager to find the password of the provisioned database user.
36-
3. Create a [cloud service request ticket](https://jiraent.cms.gov/plugins/servlet/desk/portal/22) to have the db instance added to the ZScaler Private Segment. Note: Unil this is completed, you will only be able to connect locally with ZScaler fully disabled (turning off Private Access is not sufficient).
25+
Production is `prod`.
3726

38-
### Modify Provisioned Resources
39-
1. Change the settings in `main.tf`
40-
2. Run
27+
Some examples:
4128

42-
```sh
43-
terraform apply
29+
```bash
30+
npd-east-dev-fhir-api
31+
npd-east-test-fhir-api
32+
npd-east-dev-fhir-database
33+
npd-east-test-fhir-database-replica-1
34+
npd-east-dev-load-fips-bronze-job
4435
```
4536

46-
## Development
47-
48-
- Build a Docker container locally
49-
- Push the Docker container to ECR, following the included instructions on the AWS console
50-
- Update the container image variable by setting the `TF_VAR_container_image` environment variable as well as any other differences like `TF_VAR_container_port`
51-
- You can also specify these in a `.tfvars` file ignored by git
52-
- Update any task definition parameters that are different for your container
53-
54-
## DSAC Sandbox
37+
## Usage
5538

56-
This infrastructure lives in the DSAC sandbox. A GitHub Actions workflow [deploy-to-sandbox.yml](../.github/workflows/deploy-to-sandbox.yml) updates the sandbox infrastructure when a PR to `main` is merged.
39+
### Deploy (manual)
5740

58-
## Notes
59-
60-
- This is **not a production configuration**, in particular when it comes to security. It mostly focuses on handling a lot of the annoying footguns when getting started with a deployed dev environment
61-
- This is a starting point that we will build off of
62-
- This is very coupled to running in the DSAC sandbox environment
63-
- In order to connect to the database, it is recommended that you set a connection timeout of 300 seconds.
64-
65-
66-
## Notional Infrastructure Diagram
67-
The below diagram is a rough hypothesis of the infrastructure components that will make up the National Provider Directory MVP.
68-
![Notional architecture diagram](<Notional NPD System Diagram_2025-08-26_19-37-04.png>)
41+
1. Create an environment specific `.env` file, using `.env.template` as a reference
42+
```
43+
(one of)
44+
.env.sandbox
45+
.env.dev
46+
.env.test
47+
.env.prod
48+
```
49+
2. Assume an AWS Role using `./ctkey.sh`
50+
```
51+
(one of)
52+
./ctkey.sh sandbox
53+
./ctkey.sh dev
54+
./ctkey.sh test
55+
./ctkey.sh prod
56+
```
57+
3. Initialize terraform
58+
```
59+
(one of)
60+
terraform -chdir=envs/sandbox init
61+
terraform -chdir=envs/dev init
62+
terraform -chdir=envs/test init
63+
terraform -chdir=envs/prod init
64+
```
65+
4. Deploy resources using terraform
66+
```
67+
(one of)
68+
terraform -chdir=envs/sandbox apply
69+
terraform -chdir=envs/dev apply
70+
terraform -chdir=envs/test apply
71+
terraform -chdir=envs/prod apply
72+
```

infrastructure/envs/nonprod/README.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)