├── .deepsource.toml ├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── auto_assignee.yml │ ├── automerge.yml │ ├── changelog.yml │ ├── readme.yml │ ├── tf-checks.yml │ ├── tflint.yml │ └── tfsec.yml ├── .gitignore ├── .pre-commit-config.yaml ├── CHANGELOG.md ├── LICENSE ├── Makefile ├── README.md ├── README.yaml ├── docs └── io.md ├── examples ├── main.tf ├── outputs.tf └── versions.tf ├── main.tf ├── outputs.tf ├── variables.tf └── versions.tf /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "terraform" 5 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in the repo. 2 | * @anmolnagpal @clouddrove/approvers @clouddrove-ci 3 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## what 2 | * Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?) 3 | * Use bullet points to be concise and to the point. 4 | 5 | ## why 6 | * Provide the justifications for the changes (e.g. business case). 7 | * Describe why these changes were made (e.g. why do these commits fix the problem?) 8 | * Use bullet points to be concise and to the point. 9 | 10 | ## references 11 | * Link to any supporting jira issues or helpful documentation to add some context (e.g. stackoverflow). 12 | * Use `closes #123`, if this PR closes a Jira issue `#123` 13 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "terraform" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | # Add assignees 13 | assignees: 14 | - "clouddrove-ci" 15 | # Add reviewer 16 | reviewers: 17 | - "approvers" 18 | - package-ecosystem: "terraform" # See documentation for possible values 19 | directory: "examples/" # Location of package manifests 20 | schedule: 21 | interval: "weekly" 22 | # Add assignees 23 | assignees: 24 | - "clouddrove-ci" 25 | # Add reviewer 26 | reviewers: 27 | - "approvers" 28 | -------------------------------------------------------------------------------- /.github/workflows/auto_assignee.yml: -------------------------------------------------------------------------------- 1 | name: Auto Assign PRs 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened] 6 | 7 | workflow_dispatch: 8 | jobs: 9 | assignee: 10 | uses: clouddrove/github-shared-workflows/.github/workflows/auto_assignee.yml@master 11 | secrets: 12 | GITHUB: ${{ secrets.GITHUB }} 13 | with: 14 | assignees: 'clouddrove-ci' 15 | -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Auto merge 3 | on: 4 | pull_request: 5 | jobs: 6 | auto-merge: 7 | uses: clouddrove/github-shared-workflows/.github/workflows/auto_merge.yml@master 8 | secrets: 9 | GITHUB: ${{ secrets.GITHUB }} 10 | with: 11 | tfcheck: 'examples / Check code format' 12 | ... 13 | -------------------------------------------------------------------------------- /.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | name: changelog 2 | permissions: write-all 3 | on: 4 | push: 5 | tags: 6 | - "*" 7 | workflow_dispatch: 8 | jobs: 9 | changelog: 10 | uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master 11 | secrets: inherit 12 | with: 13 | branch: 'master' 14 | -------------------------------------------------------------------------------- /.github/workflows/readme.yml: -------------------------------------------------------------------------------- 1 | name: 'Readme Workflow' 2 | on: 3 | push: 4 | branches: 5 | - master 6 | paths-ignore: 7 | - 'README.md' 8 | - 'docs/**' 9 | workflow_dispatch: 10 | 11 | jobs: 12 | README: 13 | uses: clouddrove/github-shared-workflows/.github/workflows/readme.yml@master 14 | secrets: 15 | TOKEN : ${{ secrets.GITHUB }} 16 | SLACK_WEBHOOK_TERRAFORM: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} -------------------------------------------------------------------------------- /.github/workflows/tf-checks.yml: -------------------------------------------------------------------------------- 1 | name: tf-checks 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | workflow_dispatch: 7 | jobs: 8 | examples: 9 | uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master 10 | with: 11 | working_directory: './examples/' 12 | -------------------------------------------------------------------------------- /.github/workflows/tflint.yml: -------------------------------------------------------------------------------- 1 | name: tf-lint 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | workflow_dispatch: 7 | jobs: 8 | tf-lint: 9 | uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master 10 | secrets: 11 | GITHUB: ${{ secrets.GITHUB }} 12 | -------------------------------------------------------------------------------- /.github/workflows/tfsec.yml: -------------------------------------------------------------------------------- 1 | name: tfsec 2 | permissions: write-all 3 | on: 4 | pull_request: 5 | workflow_dispatch: 6 | jobs: 7 | tfsec: 8 | uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master 9 | secrets: inherit 10 | with: 11 | working_directory: '.' 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignored files 2 | *~ 3 | 4 | # temporary files which can be created if a process still has a handle open of a deleted file 5 | .fuse_hidden* 6 | 7 | # KDE directory preferences 8 | .directory 9 | 10 | # Linux trash folder which might appear on any partition or disk 11 | .Trash-* 12 | 13 | # .nfs files are created when an open file is removed but is still being accessed 14 | .nfs* 15 | ### Eclipse template 16 | 17 | .metadata 18 | bin/ 19 | tmp/ 20 | *.tmp 21 | *.bak 22 | *.swp 23 | *~.nib 24 | local.properties 25 | .settings/ 26 | .loadpath 27 | .recommenders 28 | 29 | # External tool builders 30 | .externalToolBuilders/ 31 | 32 | # Locally stored "Eclipse launch configurations" 33 | *.launch 34 | 35 | # PyDev specific (Python IDE for Eclipse) 36 | *.pydevproject 37 | 38 | # CDT-specific (C/C++ Development Tooling) 39 | .cproject 40 | 41 | # Java annotation processor (APT) 42 | .factorypath 43 | 44 | # PDT-specific (PHP Development Tools) 45 | .buildpath 46 | 47 | # sbteclipse plugin 48 | .target 49 | 50 | # Tern plugin 51 | .tern-project 52 | 53 | # TeXlipse plugin 54 | .texlipse 55 | 56 | # STS (Spring Tool Suite) 57 | .springBeans 58 | 59 | # Code Recommenders 60 | .recommenders/ 61 | 62 | # Scala IDE specific (Scala & Java development for Eclipse) 63 | .cache-main 64 | .scala_dependencies 65 | .worksheet 66 | ### Windows template 67 | # Windows thumbnail cache files 68 | Thumbs.db 69 | ehthumbs.db 70 | ehthumbs_vista.db 71 | 72 | # Dump file 73 | *.stackdump 74 | 75 | # Folder config file 76 | [Dd]esktop.ini 77 | 78 | # Recycle Bin used on file shares 79 | $RECYCLE.BIN/ 80 | 81 | # Windows Installer files 82 | *.cab 83 | *.msi 84 | *.msm 85 | *.msp 86 | 87 | # Windows shortcuts 88 | *.lnk 89 | ### Ansible template 90 | *.retry 91 | ### macOS template 92 | # General 93 | .DS_Store 94 | .AppleDouble 95 | .LSOverride 96 | 97 | # Icon must end with two \r 98 | Icon 99 | 100 | # Thumbnails 101 | ._* 102 | 103 | # Files that might appear in the root of a volume 104 | .DocumentRevisions-V100 105 | .fseventsd 106 | .Spotlight-V100 107 | .TemporaryItems 108 | .Trashes 109 | .VolumeIcon.icns 110 | .com.apple.timemachine.donotpresent 111 | 112 | # Directories potentially created on remote AFP share 113 | .AppleDB 114 | .AppleDesktop 115 | Network Trash Folder 116 | Temporary Items 117 | .apdisk 118 | ### Archives template 119 | # It's better to unpack these files and commit the raw source because 120 | # git has its own built in compression methods. 121 | *.7z 122 | *.jar 123 | *.rar 124 | *.zip 125 | *.gz 126 | *.tgz 127 | *.bzip 128 | *.bz2 129 | *.xz 130 | *.lzma 131 | *.cab 132 | 133 | # Packing-only formats 134 | *.iso 135 | *.tar 136 | 137 | # Package management formats 138 | *.dmg 139 | *.xpi 140 | *.gem 141 | *.egg 142 | *.deb 143 | *.rpm 144 | *.msi 145 | *.msm 146 | *.msp 147 | ### JetBrains template 148 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 149 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 150 | 151 | /.idea/ 152 | # User-specific stuff: 153 | .idea/**/workspace.xml 154 | .idea/**/tasks.xml 155 | .idea/dictionaries 156 | 157 | # Sensitive or high-churn files: 158 | .idea/**/dataSources/ 159 | .idea/**/dataSources.ids 160 | .idea/**/dataSources.xml 161 | .idea/**/dataSources.local.xml 162 | .idea/**/sqlDataSources.xml 163 | .idea/**/dynamic.xml 164 | .idea/**/uiDesigner.xml 165 | 166 | # Gradle: 167 | .idea/**/gradle.xml 168 | .idea/**/libraries 169 | 170 | # CMake 171 | cmake-build-debug/ 172 | 173 | # Mongo Explorer plugin: 174 | .idea/**/mongoSettings.xml 175 | 176 | ## File-based project format: 177 | *.iws 178 | 179 | ## Plugin-specific files: 180 | 181 | # IntelliJ 182 | out/ 183 | 184 | # mpeltonen/sbt-idea plugin 185 | .idea_modules/ 186 | # User-specific stuff: 187 | .idea/* 188 | # JIRA plugin 189 | atlassian-ide-plugin.xml 190 | 191 | # Cursive Clojure plugin 192 | .idea/replstate.xml 193 | 194 | # TFstste 195 | *.tfstate* 196 | 197 | deployment/_logs/ansible-log.json 198 | deployment/_logs/ansible-log.log 199 | deployment/_logs/facts/* 200 | deployment/_logs/retry/* 201 | _app/* 202 | ansible-log.json 203 | .terraform 204 | terraform.tfstate 205 | 206 | *.tfstate 207 | *.tfstate.backup 208 | *.iml 209 | *.terraform.lock.hcl 210 | *.lock.hcl -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | 3 | - repo: https://github.com/gruntwork-io/pre-commit 4 | rev: v0.1.23 # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases 5 | hooks: 6 | - id: terraform-fmt 7 | - id: shellcheck 8 | - id: tflint 9 | 10 | - repo: https://github.com/pre-commit/pre-commit-hooks 11 | rev: v3.4.0 # Use the ref you want to point at 12 | hooks: 13 | - id: end-of-file-fixer 14 | - id: trailing-whitespace 15 | - id: mixed-line-ending 16 | - id: check-byte-order-marker 17 | - id: check-executables-have-shebangs 18 | - id: check-merge-conflict 19 | - id: debug-astatements 20 | - id: check-yaml 21 | - id: check-added-large-files 22 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.3.0] - 2022-12-28 8 | ### :bug: Bug Fixes 9 | - [`e03514f`](https://github.com/clouddrove/terraform-aws-labels/commit/e03514f0ddf452501041ff53e53742a3508165ef) - update workflows. 10 | 11 | 12 | ## [1.0.1] - 2022-05-13 13 | ### :bug: Bug Fixes 14 | - [`e03514f`](https://github.com/clouddrove/terraform-aws-labels/commit/e03514f0ddf452501041ff53e53742a3508165ef) - update workflows 15 | - [`898f0a3`](https://github.com/clouddrove/terraform-aws-labels/commit/898f0a368900c3b118737cc9644376ee005f85f3) - update terraform version 16 | 17 | 18 | ## [0.15.0] - 2021-06-17 19 | ### :bug: Bug Fixes 20 | - [`1e03514f`](https://github.com/clouddrove/terraform-aws-labels/commit/e03514f0ddf452501041ff53e53742a3508165ef) - update workflows 21 | - [`898f0a31`](https://github.com/clouddrove/terraform-aws-labels/commit/898f0a368900c3b118737cc9644376ee005f85f3) - update terraform version 22 | - [`d231cda`](https://github.com/clouddrove/terraform-aws-labels/commit/d231cdaefd84024de6b782cb09440b18c8145ca9) - github-action Update, update in 1.0.1 23 | - [`111487cc4`](1https://github.com/clouddrove/terraform-aws-labels/commit/1487cc495b7cd45cd2270cd42738353c5cbc2b83) - update with new github-action 24 | - [`9813ca6`](https://github.com/clouddrove/terraform-aws-labels/commit/9813ca630f466b69bb3748b98dd21dde2190b73f) - fix terratest 25 | 26 | ## [0.14.0] - 2021-01-18 27 | ### :sparkles: New Features 28 | - [`1d231cda`](https://github.com/clouddrove/terraform-aws-labels/commit/d231cdaefd84024de6b782cb09440b18c8145ca91) - github-action Update, update in 1.0.1 29 | - [`29dc473`](https://github.com/clouddrove/terraform-aws-labels/commit/29dc4730a5ad231c96427fc46c8bb810d76fe8ee) - Delete terraform.json 30 | - [`7d4ed44`](https://github.com/clouddrove/terraform-aws-labels/commit/7d4ed44d106b590e45e3cb06eea6c7358b2583fc) - impliment & upgrade to 0.15 31 | 32 | 33 | ## [0.13.0] - 2020-10-01 34 | ### :bug: Bug Fixes 35 | - [`043911e`](https://github.com/clouddrove/terraform-aws-labels/commit/043911e47e4c8ca8c5216439125fa5b521502f91) - update in 0.15 36 | - [`8bfcd73`](https://github.com/clouddrove/terraform-aws-labels/commit/8bfcd7372f8130c3f5adc3f63779e0c3df1b4e0a) - upgrade docker images 37 | - [`1306e7d`](https://github.com/clouddrove/terraform-aws-labels/commit/1306e7d6185b4a77b3043ab440cd5f3ae115e98c) - upgarde precommit version 38 | - [`144711d`](https://github.com/clouddrove/terraform-aws-labels/commit/144711d4692c6acf9a4c32a30ac1cbefb1caffcb) - upgrade terraform to 0.13 and update 39 | 40 | ### :sparkles: New Features 41 | - [`288bb59`](https://github.com/clouddrove/terraform-aws-labels/commit/288bb591c4ad4b8d2dfe58ff76920bcba8d76cf2) - impliment & upgrade to 0.15 42 | 43 | 44 | ## [0.12.1] - 2020-05-24 45 | ### :bug: Bug Fixes 46 | - [`8bfcd73`](https://github.com/clouddrove/terraform-aws-labels/commit/8bfcd7372f8130c3f5adc3f63779e0c3df1b4e0a) - upgrade docker images 47 | - [`87b6840`](https://github.com/clouddrove/terraform-aws-labels/commit/87b68406a8d4f312b8a8dd5abf7443e0c3674d30) - impliment & upgrade to 0.15 48 | - [`587faf4`](https://github.com/clouddrove/terraform-aws-labels/commit/587faf4cd6b23c20981416e3a0c2a87de93c479e) - fix the attributes 49 | - [`3e1aae4`](https://github.com/clouddrove/terraform-aws-labels/commit/3e1aae475c42015f9d5ca00185d1697501187922) - upgrade to 0.14 50 | - [`1306e7d`](https://github.com/clouddrove/terraform-aws-labels/commit/1306e7d6185b4a77b3043ab440cd5f3ae115e98c) - upgarde precommit version 51 | - [`240210f`](https://github.com/clouddrove/terraform-aws-labels/commit/240210f92725d8012a10b299e9454e407922a87d) - terraform v0.13 52 | 53 | ## [0.12.0] - 2019-10-12 54 | ### :bug: Bug Fixes 55 | - [`cab48e3`](https://github.com/clouddrove/terraform-aws-labels/commit/cab48e3f2df03f427961e3d063b411445de4d4ac) - impliment & upgrade to 0.15 56 | - [`b966600`](https://github.com/clouddrove/terraform-aws-labels/commit/b9666000fa455b39187843e411dcc5a0d71af1b2) -upgarde precommit version 57 | - [`431d7cc`](https://github.com/clouddrove/terraform-aws-labels/commit/431d7cc7a76986b0f40919df33fb57eab011a5df) - upgrade terraform version to 0.14, add, update 58 | 59 | 60 | ## [0.11.0] - 2019-10-12 61 | ### :bug: Bug Fixes 62 | - [`7d4ed44`](https://github.com/clouddrove/terraform-aws-labels/commit/7d4ed44d106b590e45e3cb06eea6c7358b2583fc) - impliment & upgrade to 0.15 63 | - [`2117a76`](https://github.com/clouddrove/terraform-aws-labels/commit/2117a76a394d10416c6e5d8c1981314e75639578) - upgrade to 0.14 64 | - [`3c7ba91`](https://github.com/clouddrove/terraform-aws-labels/commit/3c7ba91e920efdf6e52bfab75fdb9be7a1b006e0) - upgarde precommit version 65 | 66 | 67 | [0.11.0]: https://github.com/clouddrove/terraform-aws-labels/compare/0.11.0...master 68 | [0.12.0]: https://github.com/clouddrove/terraform-aws-labels/compare/0.11.0...0.12.0 69 | [0.12.1]: https://github.com/clouddrove/terraform-aws-labels/compare/0.12.0...0.12.1 70 | [0.13.0]: https://github.com/clouddrove/terraform-aws-labels/compare/0.12.1...0.13.0 71 | [0.14.0]: https://github.com/clouddrove/terraform-aws-labels/compare/0.13.0...0.14.0 72 | [0.15.0]: https://github.com/clouddrove/terraform-aws-labels/compare/0.14.0...0.15.0 73 | [1.0.1]: https://github.com/clouddrove/terraform-aws-labels/compare/0.15.0...1.0.1 74 | [1.3.0]: https://github.com/clouddrove/terraform-aws-labels/compare/1.0.1...1.3.0 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2021 CloudDrove Inc. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export GENIE_PATH ?= $(shell 'pwd')/../../../genie 2 | 3 | include $(GENIE_PATH)/Makefile 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Banner](https://github.com/clouddrove/terraform-module-template/assets/119565952/67a8a1af-2eb7-40b7-ae07-c94cde9ce062)][website] 3 |

4 | Terraform Labels 5 |

6 | 7 |

8 | With our comprehensive DevOps toolkit - streamline operations, automate workflows, enhance collaboration and, most importantly, deploy with confidence. 9 |

10 | 11 | 12 |

13 | 14 | 15 | Latest Release 16 | 17 | 18 | tfsec 19 | 20 | 21 | Licence 22 | 23 | 24 | Changelog 25 | 26 | 27 | 28 |

29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |

45 |
46 | 47 | 48 | We are a group of DevOps engineers & architects, joining hands in this ever evolving digital landscape. With our strong belief in Automation; just like microservices, always on the lookout to split the the infrastructure into smaller connected resources (database, cluster and more) which could be standardized, are manageable, scalable, secure & follow industry best practices. 49 | 50 | 51 | This module includes Terraform open source, examples, and automation tests (for better understanding), which would help you create and improve your infrastructure with minimalistic coding. 52 | 53 | 54 | 55 | 56 | ## Prerequisites and Providers 57 | 58 | This table contains both Prerequisites and Providers: 59 | 60 | | Description | Name | Version | 61 | |:-------------:|:-------------------------------------------:|:---------:| 62 | | **Prerequisite** | [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html) | >= 1.6.6 | 63 | | **Provider** | [aws](https://aws.amazon.com/) | >= 5.31.0 | 64 | 65 | 66 | 67 | 68 | 69 | ## Examples 70 | 71 | **IMPORTANT:** Since the master branch used in source varies based on new modifications, we recommend using the [release versions](https://github.com/clouddrove/terraform-aws-labels/releases). 72 | 73 | 📌 For additional usage examples, check the complete list under [`examples/`](./examples) directory. 74 | 75 | 76 | 77 | ## Inputs and Outputs 78 | 79 | Refer to complete documentation: [here](docs/io.md) 80 | 81 | 82 | 93 | 94 | 95 | 96 | ## 📑 Changelog 97 | 98 | Refer [here](CHANGELOG.md). 99 | 100 | 101 | 102 | 103 | ## ✨ Contributors 104 | 105 | Big thanks to our contributors for elevating our project with their dedication and expertise! But, we do not wish to stop there, would like to invite contributions from the community in improving these projects and making them more versatile for better reach. Remember, every bit of contribution is immensely valuable, as, together, we are moving in only 1 direction, i.e. forward. 106 | 107 | 108 | 109 | 110 |
111 |
112 | 113 | If you're considering contributing to our project, here are a few quick guidelines that we have been following (Got a suggestion? We are all ears!): 114 | 115 | - **Fork the Repository:** Create a new branch for your feature or bug fix. 116 | - **Coding Standards:** You know the drill. 117 | - **Clear Commit Messages:** Write clear and concise commit messages to facilitate understanding. 118 | - **Thorough Testing:** Test your changes thoroughly before submitting a pull request. 119 | - **Documentation Updates:** Include relevant documentation updates if your changes impact it. 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | ## Feedback 134 | Spot a bug or have thoughts to share with us? Let's squash it together! Log it in our [issue tracker](https://github.com/clouddrove/terraform-aws-labels/issues), feel free to drop us an email at [hello@clouddrove.com](mailto:hello@clouddrove.com). 135 | 136 | Show some love with a ★ on [our GitHub](https://github.com/clouddrove/terraform-aws-labels)! if our work has brightened your day! – your feedback fuels our journey! 137 | 138 | 139 | ## :rocket: Our Accomplishment 140 | 141 | We have [*100+ Terraform modules*][terraform_modules] 🙌. You could consider them finished, but, with enthusiasts like yourself, we are able to ever improve them, so we call our status - improvement in progress. 142 | 143 | - [Terraform Module Registry:](https://registry.terraform.io/namespaces/clouddrove) Discover our Terraform modules here. 144 | 145 | - [Terraform Modules for AWS/Azure Modules:](https://github.com/clouddrove/toc) Explore our comprehensive Table of Contents for easy navigation through our documentation for modules pertaining to AWS, Azure & GCP. 146 | 147 | - [Terraform Modules for Digital Ocean:](https://github.com/terraform-do-modules/toc) Check out our specialized Terraform modules for Digital Ocean. 148 | 149 | 150 | 151 | 152 | ## Join Our Slack Community 153 | 154 | Join our vibrant open-source slack community and embark on an ever-evolving journey with CloudDrove; helping you in moving upwards in your career path. 155 | Join our vibrant Open Source Slack Community and embark on a learning journey with CloudDrove. Grow with us in the world of DevOps and set your career on a path of consistency. 156 | 157 | 🌐💬What you'll get after joining this Slack community: 158 | 159 | - 🚀 Encouragement to upgrade your best version. 160 | - 🌈 Learning companionship with our DevOps squad. 161 | - 🌱 Relentless growth with daily updates on new advancements in technologies. 162 | 163 | Join our tech elites [Join Now][slack] 🚀 164 | 165 | 166 | ## Explore Our Blogs 167 | 168 | Click [here][blog] :books: :star2: 169 | 170 | ## Tap into our capabilities 171 | We provide a platform for organizations to engage with experienced top-tier DevOps & Cloud services. Tap into our pool of certified engineers and architects to elevate your DevOps and Cloud Solutions. 172 | 173 | At [CloudDrove][website], has extensive experience in designing, building & migrating environments, securing, consulting, monitoring, optimizing, automating, and maintaining complex and large modern systems. With remarkable client footprints in American & European corridors, our certified architects & engineers are ready to serve you as per your requirements & schedule. Write to us at [business@clouddrove.com](mailto:business@clouddrove.com). 174 | 175 |

We are The Cloud Experts!

176 |
177 |

We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.

178 | 179 | [website]: https://clouddrove.com 180 | [blog]: https://blog.clouddrove.com 181 | [slack]: https://www.launchpass.com/devops-talks 182 | [github]: https://github.com/clouddrove 183 | [linkedin]: https://cpco.io/linkedin 184 | [twitter]: https://twitter.com/clouddrove/ 185 | [email]: https://clouddrove.com/contact-us.html 186 | [terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language= 187 | -------------------------------------------------------------------------------- /README.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # This is the canonical configuration for the `README.md` 4 | # Run `make readme` to rebuild the `README.md` 5 | # 6 | 7 | # Name of this project 8 | name : Terraform Labels 9 | 10 | # License of this project 11 | license: "APACHE" 12 | 13 | # Canonical GitHub repo 14 | github_repo: clouddrove/terraform-aws-labels 15 | 16 | # Badges to display 17 | badges: 18 | - name: "Latest Release" 19 | image: "https://img.shields.io/github/release/clouddrove/terraform-aws-labels.svg" 20 | url: "https://github.com/clouddrove/terraform-aws-labels/releases/latest" 21 | - name: "tfsec" 22 | image: "https://github.com/clouddrove/terraform-aws-labels/actions/workflows/tfsec.yml/badge.svg" 23 | url: "https://github.com/clouddrove/terraform-aws-labels/actions/workflows/tfsec.yml" 24 | - name: "Licence" 25 | image: "https://img.shields.io/badge/License-APACHE-blue.svg" 26 | url: "LICENSE.md" 27 | - name: "Changelog" 28 | image: "https://img.shields.io/badge/Changelog-blue" 29 | url: "CHANGELOG.md" 30 | 31 | prerequesties: 32 | - name: Terraform 33 | url: https://learn.hashicorp.com/terraform/getting-started/install.html 34 | version: ">= 1.6.6" 35 | 36 | providers: 37 | - name: aws 38 | url: https://aws.amazon.com/ 39 | version: ">= 5.31.0" 40 | 41 | description: |- 42 | This terraform module is designed to generate consistent label names and tags for resources. You can use terraform-labels to implement a strict naming convention. 43 | 44 | # How to use this project 45 | usage : |- 46 | ### Simple Example 47 | Here is an example of how you can use this module in your inventory structure: 48 | ```hcl 49 | module "label" { 50 | source = "clouddrove/labels/aws" 51 | version = "1.3.0" 52 | enabled = true 53 | name = "labels" 54 | environment = "prod" 55 | managedby = "hello@clouddrove.com" 56 | repository = "https://github.com/clouddrove/terraform-labels" 57 | label_order = ["name","attributes","environment"] 58 | delimiter = "-" 59 | tags = { 60 | "Terraform Version" = "1.0.1" 61 | "created_date" = "4-Apr-21" 62 | } 63 | } 64 | ``` 65 | -------------------------------------------------------------------------------- /docs/io.md: -------------------------------------------------------------------------------- 1 | ## Inputs 2 | 3 | | Name | Description | Type | Default | Required | 4 | |------|-------------|------|---------|:--------:| 5 | | attributes | Additional attributes (e.g. `1`). | `list(string)` | `[]` | no | 6 | | case\_sensitive | Determines whether the environment variable should be case-sensitive | `bool` | `false` | no | 7 | | delimiter | Delimiter to be used between `organization`, `name`, `environment` and `attributes`. | `string` | `"-"` | no | 8 | | enabled | Set to false to prevent the module from creating any resources. | `bool` | `true` | no | 9 | | environment | Environment (e.g. `prod`, `dev`, `staging`). | `string` | `""` | no | 10 | | extra\_tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`). | `map(string)` | `{}` | no | 11 | | label\_order | Label order, e.g. sequence of application name and environment `name`,`environment`,'attribute' [`webserver`,`qa`,`devops`,`public`,] . | `list(any)` | `[]` | no | 12 | | managedby | ManagedBy, eg 'CloudDrove'. | `string` | `"hello@clouddrove.com"` | no | 13 | | name | Name (e.g. `app` or `cluster`). | `string` | `""` | no | 14 | | repository | Terraform current module repo | `string` | `"https://github.com/clouddrove/terraform-aws-labels"` | no | 15 | 16 | ## Outputs 17 | 18 | | Name | Description | 19 | |------|-------------| 20 | | attributes | Normalized attributes. | 21 | | environment | Normalized environment | 22 | | id | Disambiguated ID. | 23 | | label\_order | Normalized Tag map. | 24 | | name | Normalized name. | 25 | | repository | Terraform current module repo | 26 | | tags | Normalized Tag map. | 27 | 28 | -------------------------------------------------------------------------------- /examples/main.tf: -------------------------------------------------------------------------------- 1 | module "labels" { 2 | source = "./../" 3 | 4 | enabled = true 5 | case_sensitive = true 6 | name = "labels" 7 | environment = "test" 8 | label_order = ["name", "environment"] 9 | attributes = ["private"] 10 | extra_tags = { 11 | Application = "CloudDrove" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/outputs.tf: -------------------------------------------------------------------------------- 1 | output "id" { 2 | value = module.labels[*].id 3 | description = "Disambiguated ID." 4 | } 5 | 6 | output "tags" { 7 | value = module.labels[*].tags 8 | description = "Normalized Tag map." 9 | } 10 | 11 | output "name" { 12 | value = module.labels[*].name 13 | description = "Normalized Tag map." 14 | } -------------------------------------------------------------------------------- /examples/versions.tf: -------------------------------------------------------------------------------- 1 | # Terraform version 2 | terraform { 3 | required_version = ">= 1.6.6" 4 | 5 | required_providers { 6 | aws = { 7 | source = "hashicorp/aws" 8 | version = ">= 5.31.0" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /main.tf: -------------------------------------------------------------------------------- 1 | ## Managed By : CloudDrove 2 | ## Copyright @ CloudDrove. All Right Reserved. 3 | 4 | #Module : locals 5 | #Description : This terraform module is designed to generate consistent label names and tags for resources. You can use terraform-labels to implement a strict naming convention. 6 | 7 | locals { 8 | label_order_defaults = { 9 | label_order = ["environment", "name"] 10 | } 11 | 12 | id_context = { 13 | name = var.name 14 | environment = var.environment 15 | } 16 | 17 | label_order = length(var.label_order) > 0 ? var.label_order : local.label_order_defaults.label_order 18 | 19 | # run loop for label order and set in value. 20 | id_labels = [for l in local.label_order : local.id_context[l] if length(local.id_context[l]) > 0 && var.enabled] 21 | id = var.enabled ? (var.case_sensitive == true ? join(var.delimiter, local.id_labels, var.attributes) : lower(join(var.delimiter, local.id_labels, var.attributes))) : "" 22 | name = var.enabled ? (var.case_sensitive == true ? format("%v", var.name) : lower(format("%v", var.name))) : "" 23 | environment = var.enabled ? (var.case_sensitive == true ? format("%v", var.environment) : lower(format("%v", var.environment))) : "" 24 | managedby = var.enabled ? (var.case_sensitive == true ? format("%v", var.managedby) : lower(format("%v", var.managedby))) : "" 25 | repository = var.enabled ? (var.case_sensitive == true ? format("%v", var.repository) : lower(format("%v", var.repository))) : "" 26 | attributes = var.enabled ? (var.case_sensitive == true ? format("%v", join(var.delimiter, compact(var.attributes))) : lower(format("%v", join(var.delimiter, compact(var.attributes))))) : "" 27 | tags_context = { 28 | # For AWS we need `Name` to be disambiguated sine it has a special meaning 29 | name = local.id 30 | environment = local.environment 31 | managedby = local.managedby 32 | repository = local.repository 33 | } 34 | 35 | generated_tags = { for l in keys(local.tags_context) : title(l) => local.tags_context[l] if length(local.tags_context[l]) > 0 } 36 | 37 | tags = var.enabled ? merge(local.generated_tags, var.extra_tags) : null 38 | } 39 | -------------------------------------------------------------------------------- /outputs.tf: -------------------------------------------------------------------------------- 1 | #Module : LABLE 2 | #Description : This terraform module is designed to generate consistent label names and tags 3 | # for resources. You can use terraform-labels to implement a strict naming 4 | # convention. 5 | output "id" { 6 | value = try(local.id, null) 7 | description = "Disambiguated ID." 8 | } 9 | 10 | output "name" { 11 | value = try(local.name, null) 12 | description = "Normalized name." 13 | } 14 | 15 | output "repository" { 16 | value = try(local.repository, null) 17 | description = "Terraform current module repo" 18 | } 19 | 20 | output "environment" { 21 | value = try(local.environment, null) 22 | description = "Normalized environment" 23 | } 24 | 25 | output "attributes" { 26 | value = try(local.attributes, null) 27 | description = "Normalized attributes." 28 | } 29 | 30 | output "tags" { 31 | value = try(local.tags, null) 32 | description = "Normalized Tag map." 33 | } 34 | 35 | output "label_order" { 36 | value = try(local.label_order, null) 37 | description = "Normalized Tag map." 38 | } 39 | -------------------------------------------------------------------------------- /variables.tf: -------------------------------------------------------------------------------- 1 | #Module : LABEL 2 | #Description : Terraform label module variables. 3 | variable "name" { 4 | type = string 5 | default = "" 6 | description = "Name (e.g. `app` or `cluster`)." 7 | } 8 | 9 | variable "environment" { 10 | type = string 11 | default = "" 12 | description = "Environment (e.g. `prod`, `dev`, `staging`)." 13 | } 14 | 15 | variable "repository" { 16 | type = string 17 | default = "https://github.com/clouddrove/terraform-aws-labels" 18 | description = "Terraform current module repo" 19 | } 20 | 21 | variable "label_order" { 22 | type = list(any) 23 | default = [] 24 | description = "Label order, e.g. sequence of application name and environment `name`,`environment`,'attribute' [`webserver`,`qa`,`devops`,`public`,] ." 25 | } 26 | 27 | variable "attributes" { 28 | type = list(string) 29 | default = [] 30 | description = "Additional attributes (e.g. `1`)." 31 | } 32 | 33 | variable "extra_tags" { 34 | type = map(string) 35 | default = {} 36 | description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)." 37 | } 38 | 39 | variable "managedby" { 40 | type = string 41 | default = "hello@clouddrove.com" 42 | description = "ManagedBy, eg 'CloudDrove'." 43 | } 44 | 45 | variable "enabled" { 46 | type = bool 47 | description = "Set to false to prevent the module from creating any resources." 48 | default = true 49 | } 50 | 51 | variable "delimiter" { 52 | type = string 53 | default = "-" 54 | description = "Delimiter to be used between `organization`, `name`, `environment` and `attributes`." 55 | } 56 | 57 | variable "case_sensitive" { 58 | description = "Determines whether the environment variable should be case-sensitive" 59 | type = bool 60 | default = false 61 | } -------------------------------------------------------------------------------- /versions.tf: -------------------------------------------------------------------------------- 1 | # Terraform version 2 | terraform { 3 | required_version = ">= 1.6.6" 4 | 5 | required_providers { 6 | aws = { 7 | source = "hashicorp/aws" 8 | version = ">= 5.31.0" 9 | } 10 | } 11 | } --------------------------------------------------------------------------------