From 292c73ef1cf200a23de2f49f6d1c86734aee4370 Mon Sep 17 00:00:00 2001 From: Michael K Hunter Date: Tue, 2 Sep 2025 12:26:45 -0400 Subject: [PATCH] Update README.md (Moved from DAPPS-ITE account) Move instructions from ITE account. Include a link to ITE in the instructions. --- examples/README.md | 127 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 2 deletions(-) diff --git a/examples/README.md b/examples/README.md index 262d64b..593b567 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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)