├── .github └── workflows │ └── validate.yml.noop ├── .gitignore ├── .markdownlintrc ├── .pre-commit-config.yaml ├── .terraform-docs.yml ├── .terraform-version ├── .terraform.lock.hcl ├── .trivyignore.yaml ├── LICENSE ├── Makefile ├── README.md ├── main.tf ├── outputs.tf ├── renovate.json ├── terraform.tf ├── trivy.yaml └── variables.tf /.github/workflows/validate.yml.noop: -------------------------------------------------------------------------------- 1 | name: Validate - Terraform 2 | 3 | on: 4 | workflow_call: 5 | pull_request: 6 | push: 7 | branches: [main] 8 | 9 | jobs: 10 | validate-tf: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 14 | with: 15 | repository: ${{ github.event.pull_request.head.repo.full_name }} 16 | ref: ${{ github.event.pull_request.head.ref }} 17 | - name: Setup Terraform 18 | uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 19 | - name: Install terraform-docs 20 | run: | 21 | curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.19.0/terraform-docs-v0.19.0-linux-amd64.tar.gz 22 | tar -xzf terraform-docs.tar.gz 23 | chmod +x terraform-docs 24 | sudo mv terraform-docs /usr/local/bin/ 25 | - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 26 | with: 27 | python-version: "3.13" 28 | - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Local .terraform directories 2 | **/.terraform/* 3 | 4 | # .tfstate files 5 | *.tfstate 6 | *.tfstate.* 7 | 8 | # Crash log files 9 | crash.log 10 | crash.*.log 11 | 12 | # Exclude all .tfvars files, which are likely to contain sensitive data, such as 13 | # password, private keys, and other secrets. These should not be part of version 14 | # control as they are data points which are potentially sensitive and subject 15 | # to change depending on the environment. 16 | *.tfvars 17 | *.tfvars.json 18 | 19 | # Ignore override files as they are usually used to override resources locally and so 20 | # are not checked in 21 | override.tf 22 | override.tf.json 23 | *_override.tf 24 | *_override.tf.json 25 | *.envrc.local 26 | 27 | # Ignore transient lock info files created by terraform apply 28 | .terraform.tfstate.lock.info 29 | 30 | # Include override files you do wish to add to version control using negated pattern 31 | # !example_override.tf# Include override files you do wish to add to version control using negated pattern 32 | # 33 | # !example_override.tf 34 | 35 | # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan 36 | # example: *tfplan* 37 | tfplan 38 | *.plan 39 | *.out 40 | 41 | #Editors 42 | .DS_Store 43 | *.swp 44 | *.sublime-* 45 | .*.stamp 46 | .idea 47 | .vscode 48 | tmp/ 49 | 50 | # Ignore CLI configuration files 51 | .terraformrc 52 | terraform.rc 53 | -------------------------------------------------------------------------------- /.markdownlintrc: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "first-header-h1": false, 4 | "first-line-h1": false, 5 | "line_length": false, 6 | "no-multiple-blanks": false, 7 | "no-inline-html": false, 8 | "no-alt-text": false 9 | } 10 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v5.0.0 4 | hooks: 5 | - id: check-json 6 | - id: check-merge-conflict 7 | - id: check-yaml 8 | - id: detect-private-key 9 | - id: pretty-format-json 10 | args: 11 | - --autofix 12 | - id: trailing-whitespace 13 | - id: check-symlinks 14 | - id: end-of-file-fixer 15 | - id: mixed-line-ending 16 | 17 | - repo: https://github.com/executablebooks/mdformat 18 | rev: 0.7.21 19 | hooks: 20 | - id: mdformat 21 | additional_dependencies: 22 | - mdformat-gfm 23 | - mdformat-toc 24 | # mdformat fights with terraform_docs 25 | exclude: README.m(ark)?d(own)? 26 | 27 | - repo: https://github.com/igorshubovych/markdownlint-cli 28 | rev: v0.44.0 29 | hooks: 30 | - id: markdownlint 31 | 32 | - repo: https://github.com/terraform-docs/terraform-docs 33 | rev: "v0.19.0" 34 | hooks: 35 | - id: terraform-docs-system 36 | 37 | - repo: https://github.com/antonbabenko/pre-commit-terraform 38 | rev: v1.97.0 39 | hooks: 40 | - id: terraform_validate 41 | - id: terraform_fmt 42 | - id: terraform_tflint 43 | - id: terraform_trivy 44 | args: 45 | - --args=--ignorefile=__GIT_WORKING_DIR__/.trivyignore.yaml 46 | - --args=--config=__GIT_WORKING_DIR__trivy.yaml 47 | -------------------------------------------------------------------------------- /.terraform-docs.yml: -------------------------------------------------------------------------------- 1 | version: ">= 0.19.0, < 1.0.0" 2 | 3 | settings: 4 | html: false 5 | anchor: false 6 | escape: false 7 | lockfile: false 8 | hide-empty: false # set to true when Terraform exists 9 | formatter: "markdown table" 10 | 11 | sort: 12 | enabled: true 13 | by: required 14 | 15 | sections: 16 | show: 17 | - requirements 18 | - providers 19 | - modules 20 | - data-sources 21 | - resources 22 | - inputs 23 | - outputs 24 | 25 | recursive: 26 | enabled: false 27 | include-main: false 28 | 29 | output: 30 | file: README.md 31 | mode: inject 32 | template: |- 33 | 34 | {{ .Content }} 35 | 36 | -------------------------------------------------------------------------------- /.terraform-version: -------------------------------------------------------------------------------- 1 | 1.5.7 2 | -------------------------------------------------------------------------------- /.terraform.lock.hcl: -------------------------------------------------------------------------------- 1 | # This file is maintained automatically by "terraform init". 2 | # Manual edits may be lost in future updates. 3 | 4 | provider "registry.terraform.io/hashicorp/aws" { 5 | version = "5.84.0" 6 | constraints = "~> 5.0" 7 | hashes = [ 8 | "h1:EJLTu1eqP93P4+DexFZHnuMCwEapkmHhEUirUT+tjZw=", 9 | "h1:OJ53RNte7HLHSMxSkzu1S6H8sC0T8qnCAOcNLjjtMpc=", 10 | "h1:TpsSFMkiuLC1V29n4Ov99g4L6jlsBmBMWxqDX3GZNww=", 11 | "h1:dwpeFUdcxgXVAc0JSqO57xf0/r2qOBLPloombCQWFz8=", 12 | "zh:078f77438aba6ec8bf9154b7d223e5c71c48d805d6cd3bcf9db0cc1e82668ac3", 13 | "zh:1f6591ff96be00501e71b792ed3a5a14b21ff03afec9a1c4a3fd9300e6e5b674", 14 | "zh:2ab694e022e81dd74485351c5836148a842ed71cf640664c9d871cb517b09602", 15 | "zh:33c8ccb6e3dc496e828a7572dd981366c6271075c1189f249b9b5236361d7eff", 16 | "zh:6f31068ebad1d627e421c72ccdaafe678c53600ca73714e977bf45ff43ae5d17", 17 | "zh:7488623dccfb639347cae66f9001d39cf06b92e8081975235a1ac3a0ac3f44aa", 18 | "zh:7f042b78b9690a8725c95b91a70fc8e264011b836605bcc342ac297b9ea3937d", 19 | "zh:88b56ac6c7209dc0a775b79975a371918f3aed8f015c37d5899f31deff37c61a", 20 | "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", 21 | "zh:a1979ba840d704af0932f8de5f541cbb4caa9b6bbd25ed552a24e6772175ba07", 22 | "zh:b058c0533dae580e69d1adbc1f69e6a80632374abfc10e8634d06187a108e87b", 23 | "zh:c88610af9cf957f8dcf4382e0c9ca566ef10e3290f5de01d4d90b2d81b078aa8", 24 | "zh:e9562c055a2247d0c287772b55abef468c79f8d66a74780fe1c5e5dae1a284a9", 25 | "zh:f7a7c71d28441d925a25c08c4485c015b2d9f0338bc9707443e91ff8e161d3d9", 26 | "zh:fee533e81976d0900aa6fa443dc54ef171cbd901847f28a6e8edb1d161fa6fde", 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /.trivyignore.yaml: -------------------------------------------------------------------------------- 1 | # These are just examples to get you started. 2 | misconfigurations: 3 | - id: AVD-AWS-0342 # (MEDIUM): IAM policy allows 'iam:PassRole' action 4 | - id: AVD-AWS-0104 # (CRITICAL): Security group rule allows unrestricted egress to any IP address. 5 | - id: AVD-AWS-0176 # (MEDIUM): Instance does not have IAM Authentication enabled 6 | - id: AVD-AWS-0133 # (LOW): Instance does not have performance insights enabled. 7 | - id: AVD-AWS-0099 # (LOW): Security group explicitly uses the default description. 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright TrussWorks 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: target_lock 2 | target_lock: 3 | terraform providers lock \ 4 | -platform=windows_amd64 \ 5 | -platform=darwin_amd64 \ 6 | -platform=darwin_arm64 \ 7 | -platform=linux_amd64 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Truss Terraform Module template 2 | 3 | This repository is meant to be a template repo we can just spin up new module 4 | repos from with our general format. 5 | 6 | ## Creating a new Terraform Module 7 | 8 | 1. Clone this repo, renaming appropriately. 9 | 1. Write your terraform code in the root dir. 10 | 11 | ## Actual readme below - Delete above here 12 | 13 | Please put a description of what this module does here 14 | 15 | ## Usage 16 | 17 | ### Put an example usage of the module here 18 | 19 | ```hcl 20 | module "example" { 21 | source = "terraform/registry/path" 22 | 23 | 24 | } 25 | ``` 26 | 27 | 28 | ## Requirements 29 | 30 | | Name | Version | 31 | |------|---------| 32 | | terraform | 1.5.7 | 33 | | aws | ~> 5.0 | 34 | 35 | ## Providers 36 | 37 | No providers. 38 | 39 | ## Modules 40 | 41 | No modules. 42 | 43 | ## Resources 44 | 45 | No resources. 46 | 47 | ## Inputs 48 | 49 | No inputs. 50 | 51 | ## Outputs 52 | 53 | No outputs. 54 | 55 | 56 | ## Developer Setup 57 | 58 | - [Pre-Commit](https://pre-commit.com/) 59 | - [TFenv](https://github.com/tfutils/tfenv) 60 | - [Terraform-Docs](https://terraform-docs.io/) 61 | - [TFLint](https://github.com/terraform-linters/tflint) 62 | - [Trivy](https://trivy.dev/) 63 | 64 | Install dependencies (macOS) 65 | 66 | ```shell 67 | brew install pre-commit tfenv terraform-docs tflint trivy 68 | tfenv install 69 | pre-commit install --install-hooks 70 | ``` 71 | -------------------------------------------------------------------------------- /main.tf: -------------------------------------------------------------------------------- 1 | # main.tf placeholder 2 | -------------------------------------------------------------------------------- /outputs.tf: -------------------------------------------------------------------------------- 1 | # Outputs placeholder 2 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:recommended", 4 | "helpers:pinGitHubActionDigests" 5 | ], 6 | "labels": [ 7 | "dependencies" 8 | ], 9 | "packageRules": [ 10 | { 11 | "automerge": true, 12 | "description": "Group minor and patch updates into a single PR", 13 | "groupName": "dependencies", 14 | "matchManagers": [ 15 | "terraform", 16 | "pre-commit", 17 | "github-actions" 18 | ], 19 | "matchUpdateTypes": [ 20 | "minor", 21 | "patch", 22 | "pin", 23 | "digest" 24 | ] 25 | } 26 | ], 27 | "schedule": [ 28 | "every weekend" 29 | ], 30 | "separateMinorPatch": true, 31 | "separateMultipleMajor": true, 32 | "separateMultipleMinor": true 33 | } 34 | -------------------------------------------------------------------------------- /terraform.tf: -------------------------------------------------------------------------------- 1 | # Last MPL Licensed Terraform version 2 | terraform { 3 | required_version = "1.5.7" 4 | 5 | required_providers { 6 | aws = { 7 | source = "hashicorp/aws" 8 | version = "~> 5.0" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /trivy.yaml: -------------------------------------------------------------------------------- 1 | quiet: true 2 | 3 | scan: 4 | skip-dirs: 5 | - "**/.terraform" 6 | 7 | misconfiguration: 8 | scanners: 9 | - terraform 10 | 11 | terraform: 12 | exclude-downloaded-modules: true 13 | 14 | ignorefile: ".trivyignore.yaml" 15 | -------------------------------------------------------------------------------- /variables.tf: -------------------------------------------------------------------------------- 1 | # Variables placeholder 2 | --------------------------------------------------------------------------------