Skip to content

Commit

Permalink
Merge pull request #1 from hunte359/patch-1
Browse files Browse the repository at this point in the history
Update README.md (Moved from DAPPS-ITE account)
  • Loading branch information
badra001 committed Sep 2, 2025
2 parents 2c0e302 + 292c73e commit 0f28481
Showing 1 changed file with 125 additions and 2 deletions.
127 changes: 125 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,126 @@
# Examples
# Instantiating this configuration in another account

Create directories with specific examples and describe how to use the module in a variety of ways.
## Prerequisites

1. In the target account, be sure that `GIT-ROOT/.tf-control` shows the `TERRAFORM` variable set
to `terraform_current`.
1. Add service linked roles to `common/` (see module examples)
1. Import the account GPG key
```
# cd TARGET-GIT-ROOT
cd init/gpg-setup
git-secret reveal -f
gpg --import tf-*.gpg.asc tf-*.secret-key
```

## Steps to Clone

* Create the approriate directory in the target account

```script
# cd TARGET-GIT-ROOT
# make new branch and checkout
mkdir common/west/apps/ditd-darhts-s3-transfer
```

* Rsync (not cp)

```
# cd SOURCE # GitHub location of source: [here](https://github.e.it.census.gov/terraform/260949450014-adsd-dapps-ite-gov/tree/master/common/west/apps/ditd-darhts-s3-transfer)
rsync -avRWH ./ TARGET-GIT-ROOT/common/west/apps/ditd-darhts-s3-transfer
```

* Cleanup new directory

```
# cd TARGET-GIT-ROOT/common/west/apps/ditd-darhts-s3-transfer
tf-run superclean
rm -rf access_keys *.secret
git-secret add api.txt variables.api.auto.tfvars
```

## Steps to setup

* Work in target directory

```
# cd TARGET-GIT-ROOT/common/west/apps/ditd-darhts-s3-transfer
```

* Populate files with values

Add proper information for the new environment, new settings into the files
* api.txt
* variables.api.auto.tfvars
* variables.auto.tfvars

You can use the variables.auto.tfvars.TEMPLATE file to change just the environent, like this:

```
sed -e "s/{ENVIRONMENT}/qa/g" variables.auto.tfvars.TEMPLATE > variables.auto.tfvars
```

* Check the `tags.*.yml` for proper values

* Process and prepare for PR

```
tf-run init
tf-run plan
git-secret hide -m
git add .
```

* Commit

Commit the branch, push the commit, do the PR, upload the `tf-plan` log and add the
`tf-plan summary` to the PR body.

## Apply and beyond

* Once you have a merged PR, you may apply. You'll have a few additional steps post-apply
that need to be again submitted as git PRs.


# still in your branch
```
git pull origin master
tf-run apply
```

* Add access key to git-secret

```
git-secret add access_keys/*/access_key.yml
git-secret hide -m
git add access_keys
```

* Commit -a (to get git-secret changes)

```
git commit -a -m "insert message"
git push
```

and again do a PR to merge in all the new files generated.

You will need to distribute the `access_key.yml` file (encrypted zip) to the POC.


# CHANGELOG

- 1.0.0 -- 2025-08-18
- initial

- 1.0.1 -- 2025-08-19
- provide template for variables.auto.tfvars

- 1.0.2 -- 2025-08-19
- add git-secret post apply changes

- 1.0.3 -- 2025-08-19
- changed formatting

- 1.0.4 -- 2025-09-02
- changed locaiton to the module repo. Previous location was [DAPS ITE repo](https://github.e.it.census.gov/terraform/260949450014-adsd-dapps-ite-gov/tree/master/common/west/apps/ditd-darhts-s3-transfer)

0 comments on commit 0f28481

Please sign in to comment.