Repository: chanzuckerberg/fogg
Pull request #619 (2022-03-18 20:51:57)

feat: Add tf doc plugin to circle ci template
### Summary
Installing terraform-docs into circle ci tmpl

### References
referencing this change https://github.com/chanzuckerberg/fogg/blob/main/templates/templates/.github/workflows/fogg_ci.yml.tmpl#L29-L37


shortcut-integration[bot]: This pull request has been linked to [Shortcut Story #189672: Add tf docs plugin to circleci fogg](https://app.shortcut.com/infraeng/story/189672/add-tf-docs-plugin-to-circleci-fogg).
codecov[bot]: # [Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/619?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg) Report
> :exclamation: No coverage uploaded for pull request base (`main@d16a700`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg#section-missing-base-commit).
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##             main     #619   +/-   ##
=======================================
  Coverage        ?   54.71%           
=======================================
  Files           ?       22           
  Lines           ?     3089           
  Branches        ?        0           
=======================================
  Hits            ?     1690           
  Misses          ?     1235           
  Partials        ?      164           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/619?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/619?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg). Last update [d16a700...4863d8f](https://codecov.io/gh/chanzuckerberg/fogg/pull/619?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg).


Patch:
diff --git a/templates/templates/circleci/.circleci/config.yml.tmpl b/templates/templates/circleci/.circleci/config.yml.tmpl
index 7b422b1e..41803e8a 100644
--- a/templates/templates/circleci/.circleci/config.yml.tmpl
+++ b/templates/templates/circleci/.circleci/config.yml.tmpl
@@ -20,6 +20,15 @@ jobs:
             - {{ $sshFingerprint }}
           {{- end }}
 {{- end }}
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user


Test patch:
diff --git a/testdata/circleci/.circleci/config.yml b/testdata/circleci/.circleci/config.yml
index d8651f8f..7c557cbd 100644
--- a/testdata/circleci/.circleci/config.yml
+++ b/testdata/circleci/.circleci/config.yml
@@ -14,6 +14,15 @@ jobs:
       - add_ssh_keys:
           fingerprints:
             - d2:52:20:b3:82:e2:ee:e8:98:02:05:15:b5:37:f6:2c
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user
@@ -42,6 +51,15 @@ jobs:
       - add_ssh_keys:
           fingerprints:
             - d2:52:20:b3:82:e2:ee:e8:98:02:05:15:b5:37:f6:2c
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user
@@ -66,6 +84,15 @@ jobs:
       - add_ssh_keys:
           fingerprints:
             - d2:52:20:b3:82:e2:ee:e8:98:02:05:15:b5:37:f6:2c
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user
@@ -90,6 +117,15 @@ jobs:
       - add_ssh_keys:
           fingerprints:
             - d2:52:20:b3:82:e2:ee:e8:98:02:05:15:b5:37:f6:2c
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user
@@ -114,6 +150,15 @@ jobs:
       - add_ssh_keys:
           fingerprints:
             - d2:52:20:b3:82:e2:ee:e8:98:02:05:15:b5:37:f6:2c
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user
@@ -138,6 +183,15 @@ jobs:
       - add_ssh_keys:
           fingerprints:
             - d2:52:20:b3:82:e2:ee:e8:98:02:05:15:b5:37:f6:2c
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user
@@ -162,6 +216,15 @@ jobs:
       - add_ssh_keys:
           fingerprints:
             - d2:52:20:b3:82:e2:ee:e8:98:02:05:15:b5:37:f6:2c
+      - run:
+          command: |
+            mkdir /tmp/terraform-docs
+            cd /tmp/terraform-docs
+            # https://terraform-docs.io/user-guide/installation/#pre-compiled-binary
+            curl -sSLo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz
+            tar -xzf terraform-docs.tar.gz
+            chmod +x terraform-docs
+            echo "$PWD" >> $GITHUB_PATH
       - run: python3 -m venv venv
       - run: . venv/bin/activate
       - run: pip install awscli --upgrade --user