Skip to content

Commit de8a00f

Browse files
committed
updating documentation for clarity
1 parent dcda306 commit de8a00f

3 files changed

Lines changed: 113 additions & 26 deletions

File tree

.github/ISSUE_TEMPLATE/pre-work-template-devops-security.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ assignees: ''
99
---
1010

1111
### Prerequisite
12-
We are looking forward to having you on our team. Please ensure you have prior experience with the HfLA website team before contributing to our repository.
12+
We are looking forward to having you on our team. Please ensure you have prior experience with the HfLA website team before contributing to our repository
1313
### Overview
1414
As a new member on the HfLA devops-security team, fill in the following fields as you complete each onboarding item.
1515

@@ -22,9 +22,9 @@ As a new member on the HfLA devops-security team, fill in the following fields a
2222

2323
- [ ] Before starting to work on the below instructions, make sure to join the #ops Slack Channel. And are a member of `devops-security` repository.
2424
- [ ] Self-assign this issue (gear in right side panel).
25-
- [ ] Add this issue to the Project Board under the Projects section (gear in right side panel).
25+
- [ ] Add this issue to the Project Board CoP: DevOps: Project Board - under the Projects section (gear in right side panel).
2626
- [ ] Attend weekly team meeting, Wednesdays 6-8pm PST.
27-
- [ ] Note: There are no meetings on the 1st-7th of every month.
27+
- [ ] Note: There are no meetings on the 1st Wednesday of every month.
2828
- [ ] Complete the steps in [Creating a personal AWS account](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#creating-a-personal-aws-account) and [Login as root user & setup MFA](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#login-as-root-user-&-setup-mfa).
2929
- [ ] Read and follow the instructions in [Setting up IAM and AWS CLI](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#setting-up-iam-and-aws-cli) for:
3030
- [ ] [Creating an IAM User](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#create-an-iam-group)
@@ -35,7 +35,9 @@ As a new member on the HfLA devops-security team, fill in the following fields a
3535
- [ ] [Generating user access keys](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#generating-access-keys-for-aws-cli)
3636
- [ ] Complete the instructions in [AWS Documentation](https://docs.aws.amazon.com/cli/v1/userguide/cli-chap-install.html) and choose your operating system to install AWS CLI.
3737
- [ ] Complete the instruction in [AWS Documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-authentication-short-term.html) to setup the AWS CLI.
38-
- [ ] Read follow the instructions in [Creating a backend state](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#creating-backend-state).
38+
- [ ] Follow the instructions in [Creating a backend state](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#creating-backend-state).
39+
- [ ] Create the S3 bucket
40+
- [ ] Create the DynamoDB table
3941
- [ ] Install Terraform locally by following the instructions of the installation guide mentioned in [Installing Terraform](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#installing-terraform)
4042
- [ ] Install Terraform Docs locally by following the instructions of the installation guide mentioned in [Installing Terraform docs](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#installing-terraform-docs)
4143
- [ ] Complete the instructions in [Clone the repository](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#clone-the-repository)
@@ -46,14 +48,14 @@ As a new member on the HfLA devops-security team, fill in the following fields a
4648
git checkout -b issue-number-add-new-iam-user
4749

4850
```
49-
- [ ] Navigate to the `aws-user.tf` file and add your user information and follow the below template.
51+
- [ ] Navigate to the `aws-user.tf` file and add your user information to the end of the file following the below template.
5052

5153
```bash
52-
53-
module "iam_user_testiamuser" {
54+
# Replace USERNAME with your GitHub handle
55+
module "iam_user_USERNAME" {
5456
source = "./modules/aws-users"
5557
56-
user_name = "testiamuser"
58+
user_name = "USERNAME"
5759
user_tags = {
5860
"Project" = "devops-security"
5961
"Access Level" = "1"
@@ -63,12 +65,25 @@ As a new member on the HfLA devops-security team, fill in the following fields a
6365
6466
```
6567
- [ ] In your code editor navigate to `terraform` directory. `cd terraform`
68+
69+
Note: You must be authenticated to your AWS account via the CLI for the next commands to work. The above instructions for setting up the CLI will guide you through this process. To check to see if you are authenticated, run `aws sts get-caller-identity`. You should get a response like:
70+
71+
```
72+
{
73+
"UserId": "ABCDEFGHIJKLMNOPQRSTU",
74+
"Account": "012345678910",
75+
"Arn": "arn:aws:iam::012345678910:user/USERNAME"
76+
}
77+
```
78+
If you are unable to authenticate from your local machine using the CLI, post in the #ops channel in Slack so that the team can help you get unblocked.
6679
- [ ] Execute the command `terraform init` to initialize terraform in the directory. Address any failures that arise (if any).
6780
- [ ] Execute the command `terraform plan` this will output a plan replicating the same IAM resources as the devops security account. Address any failures that arise (if any).
68-
- [ ] Then execute the command `terraform apply` this will create all of the resources that are currently managed by Devops Security. All of the resources created here incur zero cost except for the Dynamo DB installation, which should remain in the free tier.
69-
- [ ] ** If you have cost concerns, Run a Terraform Destroy to take down all of the resources you created (don't worry, you can recreate them just as quickly). **
81+
- [ ] Then execute the command `terraform apply` this will create all of the resources that are currently managed by Devops Security. All of the resources created here incur zero cost except for the Dynamo DB installation, which should remain in the free tier. **
82+
- [ ] **If you have cost concerns, Run a Terraform Destroy to take down all of the resources you created (don't worry, you can recreate them just as quickly). If you create resources outside of what's described in this issue, you may incur charges.**
83+
- [ ] Update the README using Terraform Docs to document changes
84+
- [ ] ```terraform-docs -c .terraform.docs.yml .```
7085
- [ ] Once you have tested your changes, stage them in git with
7186
- [ ] `git status` command.
7287
- [ ] then `git add path/to/file` (you can copy from above output for the file path).
73-
- [ ] Commit the changes by executing `git commit -m "briefly describing the changes"`.
88+
- [ ] Commit the changes by executing `git commit -m "briefl description of changes"`.
7489
- [ ] Push the changes with `git push --set-upstream origin name-of-branch`

CONTRIBUTING.md

Lines changed: 85 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Below are guidelines for contributing to the devops-security repository hosted o
3232
- [**Submitting changes via git and opening a PR**](#submitting-changes-via-git-and-opening-a-pr)
3333

3434
## **Setting up the local development environment**
35-
35+
The below instructions will walk you through setting up your own AWS account for local development and testing before pushing changes that will effect our infrastructure. If you've already completed these steps, skip to [Create a branch](https://github.com/hackforla/devops-security/blob/main/CONTRIBUTING.md#create-a-new-branch-where-you-will-work-on-your-issue)
3636
### **Creating a personal AWS account**
3737

3838
- Go to [AWS](https://aws.amazon.com/) and click `"Sign In to the Console" > "Create a new AWS account."`
@@ -132,24 +132,59 @@ Below are guidelines for contributing to the devops-security repository hosted o
132132
```
133133
<sub>[Back to Table of Contents](#table-of-contents)</sub>
134134
***
135+
The below steps must be completed in order to authenticate to AWS locally via the command line interface (CLI):
135136
- [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
136137
- [Set up the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html)
137138
138139
<sub>[Back to Table of Contents](#table-of-contents)</sub>
139140
***
140141
141-
### **Installing Terraform**
142+
### **Creating Backend State**
142143
143-
Use the [Official HashiCorp install instructions](https://developer.hashicorp.com/terraform/install) for installing terraform.
144+
To facilitate AWS IAM changes using Terraform, it's essential to establish backend state storage.
144145

145-
<sub>[Back to Table of Contents](#table-of-contents)</sub>
146-
***
146+
#### Create S3 bucket
147+
- Region: `us-west-2` (Oregon)
148+
- Name: `USERNAME-hfla-ops-terraform-state`
149+
- Enable versioning
150+
- Enable server-side encryption
147151

148-
### **Creating Backend State**
152+
You can create a bucket from the AWS UI, CloudShell, or from the CLI using the following commands:
153+
154+
##### Step 1: Create the bucket
155+
`aws s3api create-bucket --bucket USERNAME-hfla-ops-terraform-state --region us-west-2 --create-bucket-configuration LocationConstraint=us-west-2`
156+
157+
##### Step 2: Enable versioning
158+
`aws s3api put-bucket-versioning --bucket USERNAME-hfla-ops-terraform-state --versioning-configuration Status=Enabled`
149159

150-
To facilitate AWS IAM changes using Terraform, it's essential to establish backend state storage. Refer to and follow the instructions outlined in this [issue](https://github.com/hackforla/ops/issues/105) to create the backend state.
160+
##### Step 3: Enable server-side encryption
161+
```bash
162+
aws s3api put-bucket-encryption --bucket USERNAME-hfla-ops-terraform-state --server-side-encryption-configuration '{
163+
"Rules": [
164+
{
165+
"ApplyServerSideEncryptionByDefault": {
166+
"SSEAlgorithm": "AES256"
167+
}
168+
}
169+
]
170+
}'
171+
```
151172

152-
**Note:** Users will need to create their backend state exactly as specified (i.e. using the same naming conventions).
173+
#### Set up DynamoDB to store the backend state
174+
175+
- Create table `hfla_ops_terraform_table`
176+
- Set partition key to `LockID` with a type of `string`
177+
- Choose on-demand capacity
178+
179+
You can create the table from the AWS UI, CloudShell, or from the CLI using the following command:
180+
181+
```bash
182+
aws dynamodb create-table \
183+
--table-name hfla_ops_terraform_table \
184+
--attribute-definitions AttributeName=LockID,AttributeType=S \
185+
--key-schema AttributeName=LockID,KeyType=HASH \
186+
--billing-mode PAY_PER_REQUEST
187+
```
153188

154189
<sub>[Back to Table of Contents](#table-of-contents)</sub>
155190
***
@@ -158,15 +193,22 @@ To facilitate AWS IAM changes using Terraform, it's essential to establish backe
158193

159194
Atfer creating a backend state, create a ```backend.tfvars``` file in the ```terraform``` directory. It should have content of this format:
160195

161-
```
162-
bucket = "{developer_specific}-hfla-ops-terraform-state"
196+
```bash
197+
bucket = "USERNAME-hfla-ops-terraform-state"
163198
key = "devops-security/terraform.tfstate"
164199
region = "us-east-2"
165-
dynamodb_table = "{developer_specific}_hfla_ops_terraform_table"
200+
dynamodb_table = "hfla_ops_terraform_table"
166201
encrypt = true
167202
```
168203

169-
Remeber to match these values to the ones in your backend state (and replace {developer-specific} with your actual name)
204+
Remember to match these values to the ones in your backend state (and replace USERNAME with your username)
205+
206+
<sub>[Back to Table of Contents](#table-of-contents)</sub>
207+
***
208+
209+
### **Installing Terraform**
210+
211+
Use the [Official HashiCorp install instructions](https://developer.hashicorp.com/terraform/install) for installing terraform.
170212

171213
<sub>[Back to Table of Contents](#table-of-contents)</sub>
172214
***
@@ -232,35 +274,63 @@ When you've finished working on your issue, follow the steps below to prepare yo
232274
***
233275
234276
### **Terraform Setup and Execution Instructions**
277+
Make the required changes and execute them to see the changes in your own AWS account
235278
236279
- Change into `terraform` directory with
237280
238281
```bash
239282
cd terraform
240283
```
241284
242-
- Next initilize the terraform configuration
285+
- Initialize the terraform configuration
243286
244287
```bash
245288
terraform init --backend-config=backend.tfvars
246289
```
247290
248-
- Then generate and run an execution plan
291+
- Generate and run an execution plan
249292
250293
```bash
251294
terraform plan
252295
```
296+
297+
- Apply your changes
298+
```bash
299+
terraform apply
300+
```
301+
302+
- Optional: delete the resources created
303+
```bash
304+
terraform destroy
305+
```
306+
253307
<sub>[Back to Table of Contents](#table-of-contents)</sub>
254308
***
255309
310+
### Generate Terraform Docs
311+
Terraform docs allow the easy updating of README files inside of Terraform directories
312+
313+
Navigate to the directory where the changes were made
314+
```bash
315+
cd terraform # or other directory
316+
```
317+
```bash
318+
terraform-docs -c .terraform.docs.yml .
319+
```
320+
256321
### **Submitting changes via git and opening a PR**
257322
258323
- We urge developers to be cautious using `git add`. In general it is not advisable to use `git add -all` or `git add .`. Rather, run `git status`, examine the output carefully, and then add only those files specifically related to the current issue. This will ensure that no extraneous files are included in the subsequent commit.
259324
325+
Example:
326+
```bash
327+
git add terraform/aws-users.tf
328+
```
329+
260330
- Then commit the changes with a descriptive message using
261331
262332
```bash
263-
git commit -m "your commit message"
333+
git commit -m "Updating documentation" # Change the message to summarize the changes you've made
264334
```
265335
266336
- Push changes to the remote repository, replace the `branch_name` with the name of the branch you are working on

terraform/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ Resources created by this code repository.
1313
| <a name="module_iam_services_supervisor_group"></a> [iam\_services\_supervisor\_group](#module\_iam\_services\_supervisor\_group) | ./modules/aws-groups | n/a |
1414
| <a name="module_iam_user_JimmyJuarez10"></a> [iam\_user\_JimmyJuarez10](#module\_iam\_user\_JimmyJuarez10) | ./modules/aws-users | n/a |
1515
| <a name="module_iam_user_abbyz123"></a> [iam\_user\_abbyz123](#module\_iam\_user\_abbyz123) | ./modules/aws-users | n/a |
16+
| <a name="module_iam_user_alexe"></a> [iam\_user\_alexe](#module\_iam\_user\_alexe) | ./modules/aws-users | n/a |
1617
| <a name="module_iam_user_awlFCCamp"></a> [iam\_user\_awlFCCamp](#module\_iam\_user\_awlFCCamp) | ./modules/aws-users | n/a |
1718
| <a name="module_iam_user_brittanyms"></a> [iam\_user\_brittanyms](#module\_iam\_user\_brittanyms) | ./modules/aws-users | n/a |
1819
| <a name="module_iam_user_chelseyb"></a> [iam\_user\_chelseyb](#module\_iam\_user\_chelseyb) | ./modules/aws-users | n/a |
1920
| <a name="module_iam_user_freaky4wrld"></a> [iam\_user\_freaky4wrld](#module\_iam\_user\_freaky4wrld) | ./modules/aws-users | n/a |
2021
| <a name="module_iam_user_jbubar"></a> [iam\_user\_jbubar](#module\_iam\_user\_jbubar) | ./modules/aws-users | n/a |
22+
| <a name="module_iam_user_rsakuma"></a> [iam\_user\_rsakuma](#module\_iam\_user\_rsakuma) | ./modules/aws-users | n/a |
2123
| <a name="module_iam_user_samuelusc"></a> [iam\_user\_samuelusc](#module\_iam\_user\_samuelusc) | ./modules/aws-users | n/a |
2224
| <a name="module_iam_user_shikha0428"></a> [iam\_user\_shikha0428](#module\_iam\_user\_shikha0428) | ./modules/aws-users | n/a |
2325
| <a name="module_iam_user_shinjonathan"></a> [iam\_user\_shinjonathan](#module\_iam\_user\_shinjonathan) | ./modules/aws-users | n/a |

0 commit comments

Comments
 (0)