From 682af133ea70a2369f50a4ab9e7bc157ee12a4c6 Mon Sep 17 00:00:00 2001
From: Veronika Gnilitska <30597968+gberenice@users.noreply.github.com>
Date: Thu, 14 Nov 2024 17:26:56 +0200
Subject: [PATCH] Initial commit
---
.coderabbit.yaml | 90 +++++++++
.editorconfig | 14 ++
.github/CODEOWNERS | 7 +
.github/PULL_REQUEST_TEMPLATE.md | 15 ++
.github/workflows/lint.yaml | 18 ++
.github/workflows/release-please.yaml | 18 ++
.github/workflows/trunk-upgrade.yaml | 34 ++++
.gitignore | 42 ++++
.pre-commit-config.yaml | 7 +
.trunk/.gitignore | 9 +
.trunk/configs/.checkov.yaml | 2 +
.trunk/configs/.markdownlint.yaml | 14 ++
.trunk/configs/.yamllint.yaml | 7 +
.trunk/trunk.yaml | 42 ++++
CHANGELOG.md | 16 ++
LICENSE | 202 +++++++++++++++++++
README.md | 43 ++++
aqua.yaml | 15 ++
context.tf | 279 ++++++++++++++++++++++++++
examples/complete/main.tf | 1 +
examples/complete/outputs.tf | 1 +
examples/complete/variables.tf | 1 +
main.tf | 3 +
outputs.tf | 4 +
variables.tf | 5 +
versions.tf | 10 +
26 files changed, 899 insertions(+)
create mode 100644 .coderabbit.yaml
create mode 100644 .editorconfig
create mode 100644 .github/CODEOWNERS
create mode 100644 .github/PULL_REQUEST_TEMPLATE.md
create mode 100644 .github/workflows/lint.yaml
create mode 100644 .github/workflows/release-please.yaml
create mode 100644 .github/workflows/trunk-upgrade.yaml
create mode 100644 .gitignore
create mode 100644 .pre-commit-config.yaml
create mode 100644 .trunk/.gitignore
create mode 100644 .trunk/configs/.checkov.yaml
create mode 100644 .trunk/configs/.markdownlint.yaml
create mode 100644 .trunk/configs/.yamllint.yaml
create mode 100644 .trunk/trunk.yaml
create mode 100644 CHANGELOG.md
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 aqua.yaml
create mode 100644 context.tf
create mode 100644 examples/complete/main.tf
create mode 100644 examples/complete/outputs.tf
create mode 100644 examples/complete/variables.tf
create mode 100644 main.tf
create mode 100644 outputs.tf
create mode 100644 variables.tf
create mode 100644 versions.tf
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
new file mode 100644
index 0000000..e279a6f
--- /dev/null
+++ b/.coderabbit.yaml
@@ -0,0 +1,90 @@
+# Docs: https://docs.coderabbit.ai/configure-coderabbit
+# Schema: https://coderabbit.ai/integrations/schema.v2.json
+# Support: https://discord.gg/GsXnASn26c
+
+language: en
+
+tone_instructions: |
+ Provide feedback in a professional, friendly, constructive, and concise tone.
+ Offer clear, specific suggestions and best practices to help enhance the code quality and promote learning.
+
+early_access: true
+
+knowledge_base:
+ # The scope of learnings to use for the knowledge base.
+ # `local` uses the repository's learnings,
+ # `global` uses the organization's learnings,
+ # `auto` uses repository's learnings for public repositories and organization's learnings for private repositories.
+ # Default value: `auto`
+ learnings:
+ scope: global
+ issues:
+ scope: global
+ pull_requests:
+ scope: global
+
+reviews:
+ profile: chill
+ auto_review:
+ # Ignore reviewing if the title of the pull request contains any of these keywords (case-insensitive)
+ ignore_title_keywords:
+ - wip
+ - draft
+ - test
+ # Set the commit status to 'pending' when the review is in progress and 'success' when it is complete.
+ commit_status: false
+ # Post review details on each review. Additionally, post a review status when a review is skipped in certain cases.
+ review_status: false
+ path_instructions:
+ - path: "**/*.tf"
+ instructions: |
+ You're a Terraform expert who has thoroughly studied all the documentation from Hashicorp https://developer.hashicorp.com/terraform/docs and OpenTofu https://opentofu.org/docs/.
+ You have a strong grasp of Terraform syntax and prioritize providing accurate and insightful code suggestions.
+ As a fan of the Cloud Posse / SweetOps ecosystem, you incorporate many of their best practices https://docs.cloudposse.com/best-practices/terraform/ while balancing them with general Terraform guidelines.
+ tools:
+ # By default, all tools are enabled.
+ # Masterpoint uses Trunk (https://trunk.io) so we do not need a lot of this feedback due to overlap.
+ shellcheck:
+ enabled: false
+ ruff:
+ enabled: false
+ markdownlint:
+ enabled: false
+ github-checks:
+ enabled: false
+ languagetool:
+ enabled: false
+ biome:
+ enabled: false
+ hadolint:
+ enabled: false
+ swiftlint:
+ enabled: false
+ phpstan:
+ enabled: false
+ golangci-lint:
+ enabled: false
+ yamllint:
+ enabled: false
+ gitleaks:
+ enabled: false
+ checkov:
+ enabled: false
+ detekt:
+ enabled: false
+ eslint:
+ enabled: false
+ rubocop:
+ enabled: false
+ buf:
+ enabled: false
+ regal:
+ enabled: false
+ actionlint:
+ enabled: false
+ pmd:
+ enabled: false
+ cppcheck:
+ enabled: false
+ circleci:
+ enabled: false
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..3df0e9f
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,14 @@
+# Unix-style newlines with a newline ending every file
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+max_line_length = 0
+
+[COMMIT_EDITMSG]
+max_line_length = 0
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000..4a035e9
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,7 @@
+# Use this file to define individuals or teams that are responsible for code in a repository.
+# Read more:
+#
+# Order is important: the last matching pattern takes the most precedence
+
+# These owners will be the default owners for everything
+* @masterpointio/masterpoint-internal
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..c713685
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,15 @@
+## what
+
+- Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
+- Use bullet points to be concise and to the point.
+
+## why
+
+- Provide the justifications for the changes (e.g. business case).
+- Describe why these changes were made (e.g. why do these commits fix the problem?)
+- Use bullet points to be concise and to the point.
+
+## references
+
+- Link to any supporting GitHub issues or helpful documentation to add some context (e.g. Stackoverflow).
+- Use `closes #123`, if this PR closes a GitHub issue `#123`
diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
new file mode 100644
index 0000000..092d215
--- /dev/null
+++ b/.github/workflows/lint.yaml
@@ -0,0 +1,18 @@
+name: Lint
+
+on: pull_request
+
+permissions:
+ actions: read
+ checks: write
+ contents: read
+ pull-requests: read
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out Git repository
+ uses: actions/checkout@v4
+ - name: Trunk Check
+ uses: trunk-io/trunk-action@v1
diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml
new file mode 100644
index 0000000..13798ec
--- /dev/null
+++ b/.github/workflows/release-please.yaml
@@ -0,0 +1,18 @@
+name: Release Please
+
+on:
+ push:
+ branches:
+ - main
+
+permissions:
+ contents: write
+ pull-requests: write
+
+jobs:
+ release-please:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f #v4.1.3
+ with:
+ release-type: terraform-module
diff --git a/.github/workflows/trunk-upgrade.yaml b/.github/workflows/trunk-upgrade.yaml
new file mode 100644
index 0000000..8b14fcc
--- /dev/null
+++ b/.github/workflows/trunk-upgrade.yaml
@@ -0,0 +1,34 @@
+name: Trunk Upgrade
+
+on:
+ schedule:
+ # On the first day of every month @ 8am
+ - cron: 0 8 1 * *
+ workflow_dispatch: {}
+
+permissions: read-all
+
+jobs:
+ trunk-upgrade:
+ runs-on: ubuntu-latest
+ permissions:
+ # For trunk to create PRs
+ contents: write
+ pull-requests: write
+ steps:
+ - name: Checkout
+ uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
+
+ - name: Create Token for MasterpointBot App
+ uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a #v2.1.0
+ id: generate-token
+ with:
+ app_id: ${{ secrets.MP_BOT_APP_ID }}
+ private_key: ${{ secrets.MP_BOT_APP_PRIVATE_KEY }}
+
+ - name: Upgrade
+ uses: trunk-io/trunk-action/upgrade@86b68ffae610a05105e90b1f52ad8c549ef482c2 #v1.1.16
+ with:
+ github-token: ${{ steps.generate-token.outputs.token }}
+ reviewers: "@masterpointio/masterpoint-internal"
+ prefix: "chore: "
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0807788
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,42 @@
+# Ignore override files as they are usually used to override resources locally
+*override.tf
+*override.tf.json
+
+# .tfstate files
+*.tfstate
+*.tfstate.*
+
+# Local .terraform directories
+**/.terraform/*
+
+# IDE/Editor settings
+**/.idea
+**/*.iml
+.vscode/
+*.orig
+*.draft
+*~
+
+# Build Harness https://github.com/cloudposse/build-harness
+**/.build-harness
+**/build-harness
+
+# Log files
+*.log
+
+# Output from other tools that might be used alongside Terraform/OpenTofu
+*.tfvars.json
+backend.tf.json
+
+# Taskit files
+.taskit/
+.task/
+.env.taskit-secrets
+
+# Other
+**/*.backup
+***/*.tmp
+**/*.temp
+**/*.bak
+**/*.*swp
+**/.DS_Store
\ No newline at end of file
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..3945246
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,7 @@
+# Prerequisites:
+# brew install pre-commit terraform-docs
+repos:
+ - repo: https://github.com/antonbabenko/pre-commit-terraform
+ rev: v1.88.0
+ hooks:
+ - id: terraform_docs
diff --git a/.trunk/.gitignore b/.trunk/.gitignore
new file mode 100644
index 0000000..15966d0
--- /dev/null
+++ b/.trunk/.gitignore
@@ -0,0 +1,9 @@
+*out
+*logs
+*actions
+*notifications
+*tools
+plugins
+user_trunk.yaml
+user.yaml
+tmp
diff --git a/.trunk/configs/.checkov.yaml b/.trunk/configs/.checkov.yaml
new file mode 100644
index 0000000..ea116ec
--- /dev/null
+++ b/.trunk/configs/.checkov.yaml
@@ -0,0 +1,2 @@
+skip-check:
+ - CKV_TF_1 # Ensure module references are pinned to a commit SHA.
diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml
new file mode 100644
index 0000000..c97ae62
--- /dev/null
+++ b/.trunk/configs/.markdownlint.yaml
@@ -0,0 +1,14 @@
+# Autoformatter friendly markdownlint config (all formatting rules disabled)
+default: true
+blank_lines: false
+bullet: false
+html: false
+indentation: false
+line_length: false
+spaces: false
+url: false
+whitespace: false
+
+# Ignore MD041/first-line-heading/first-line-h1
+# Error: First line in a file should be a top-level heading
+MD041: false
diff --git a/.trunk/configs/.yamllint.yaml b/.trunk/configs/.yamllint.yaml
new file mode 100644
index 0000000..184e251
--- /dev/null
+++ b/.trunk/configs/.yamllint.yaml
@@ -0,0 +1,7 @@
+rules:
+ quoted-strings:
+ required: only-when-needed
+ extra-allowed: ["{|}"]
+ key-duplicates: {}
+ octal-values:
+ forbid-implicit-octal: true
diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml
new file mode 100644
index 0000000..eca5482
--- /dev/null
+++ b/.trunk/trunk.yaml
@@ -0,0 +1,42 @@
+# This file controls the behavior of Trunk: https://docs.trunk.io/cli
+# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
+version: 0.1
+cli:
+ version: 1.22.7
+# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
+plugins:
+ sources:
+ - id: trunk
+ ref: v1.6.4
+ uri: https://github.com/trunk-io/plugins
+# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
+runtimes:
+ enabled:
+ - node@18.12.1
+ - python@3.10.8
+# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
+lint:
+ disabled:
+ # Incompatible with some Terraform features: https://github.com/tenable/terrascan/issues/1331
+ - terrascan
+ enabled:
+ - tofu@1.8.4
+ - actionlint@1.7.3
+ - checkov@3.2.276
+ - git-diff-check
+ - markdownlint@0.42.0
+ - prettier@3.3.3
+ - tflint@0.53.0
+ - trivy@0.56.2
+ - trufflehog@3.83.1
+ - yamllint@1.35.1
+ ignore:
+ - linters: [tofu]
+ paths:
+ - "**/backend.tf.json"
+actions:
+ enabled:
+ - trunk-announce
+ - trunk-check-pre-push
+ - trunk-fmt-pre-commit
+ - trunk-upgrade-available
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..b81b0ba
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,16 @@
+# Changelog
+
+## [0.2.0](https://github.com/masterpointio/terraform-module-template/compare/v0.1.1...v0.2.0) (2024-11-14)
+
+
+### Features
+
+* adds GH + CRabbit configs ([d86d463](https://github.com/masterpointio/terraform-module-template/commit/d86d463385d501db5465b02de13d60c925b5815d))
+
+## [0.1.1](https://github.com/masterpointio/terraform-module-template/compare/0.1.0...v0.1.1) (2024-08-15)
+
+
+### Bug Fixes
+
+* remove markdown trailing whitespace ([d609646](https://github.com/masterpointio/terraform-module-template/commit/d6096463b916eb536603d4ca3b2f3315e3fec9f2))
+* removes redundant editorconfig settings ([bbe0050](https://github.com/masterpointio/terraform-module-template/commit/bbe0050450cece8074f3d9ff5c3bd72ff01d8a1b))
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..6b571c5
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2024 Masterpoint
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..865dbf2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,43 @@
+# terraform-module-template
+
+[![Release](https://img.shields.io/github/release/masterpointio/terraform-module-template.svg)](https://github.com/masterpointio/terraform-module-template/releases/latest)
+
+This repository serves as a template for creating Terraform modules, providing a standardized structure and essential files for efficient module development. It's designed to ensure consistency and best practices across Terraform projects.
+
+## Usage
+
+TODO
+
+
+
+## Requirements
+
+No requirements.
+
+## Providers
+
+No provider.
+
+## Inputs
+
+No input.
+
+## Outputs
+
+No output.
+
+
+
+## Contributing
+
+Contributions are welcome and appreciated!
+
+Found an issue or want to request a feature? [Open an issue](TODO)
+
+Want to fix a bug you found or add some functionality? Fork, clone, commit, push, and PR and we'll check it out.
+
+If you have any issues or are waiting a long time for a PR to get merged then feel free to ping us at [hello@masterpoint.io](mailto:hello@masterpoint.io).
+
+## Built By
+
+[![Masterpoint Logo](https://i.imgur.com/RDLnuQO.png)](https://masterpoint.io)
diff --git a/aqua.yaml b/aqua.yaml
new file mode 100644
index 0000000..800bfdd
--- /dev/null
+++ b/aqua.yaml
@@ -0,0 +1,15 @@
+---
+# aqua - Declarative CLI Version Manager
+# https://aquaproj.github.io/
+# checksum:
+# enabled: true
+# require_checksum: true
+# supported_envs:
+# - all
+registries:
+ - type: standard
+ ref: v4.210.0 # renovate: depName=aquaproj/aqua-registry
+packages:
+ - name: terraform-docs/terraform-docs@v0.18.0
+ - name: hashicorp/terraform@v1.9.3
+ - name: opentofu/opentofu@v1.8.0
diff --git a/context.tf b/context.tf
new file mode 100644
index 0000000..5e0ef88
--- /dev/null
+++ b/context.tf
@@ -0,0 +1,279 @@
+#
+# ONLY EDIT THIS FILE IN github.com/cloudposse/terraform-null-label
+# All other instances of this file should be a copy of that one
+#
+#
+# Copy this file from https://github.com/cloudposse/terraform-null-label/blob/master/exports/context.tf
+# and then place it in your Terraform module to automatically get
+# Cloud Posse's standard configuration inputs suitable for passing
+# to Cloud Posse modules.
+#
+# curl -sL https://raw.githubusercontent.com/cloudposse/terraform-null-label/master/exports/context.tf -o context.tf
+#
+# Modules should access the whole context as `module.this.context`
+# to get the input variables with nulls for defaults,
+# for example `context = module.this.context`,
+# and access individual variables as `module.this.`,
+# with final values filled in.
+#
+# For example, when using defaults, `module.this.context.delimiter`
+# will be null, and `module.this.delimiter` will be `-` (hyphen).
+#
+
+module "this" {
+ source = "cloudposse/label/null"
+ version = "0.25.0" # requires Terraform >= 0.13.0
+
+ enabled = var.enabled
+ namespace = var.namespace
+ tenant = var.tenant
+ environment = var.environment
+ stage = var.stage
+ name = var.name
+ delimiter = var.delimiter
+ attributes = var.attributes
+ tags = var.tags
+ additional_tag_map = var.additional_tag_map
+ label_order = var.label_order
+ regex_replace_chars = var.regex_replace_chars
+ id_length_limit = var.id_length_limit
+ label_key_case = var.label_key_case
+ label_value_case = var.label_value_case
+ descriptor_formats = var.descriptor_formats
+ labels_as_tags = var.labels_as_tags
+
+ context = var.context
+}
+
+# Copy contents of cloudposse/terraform-null-label/variables.tf here
+
+variable "context" {
+ type = any
+ default = {
+ enabled = true
+ namespace = null
+ tenant = null
+ environment = null
+ stage = null
+ name = null
+ delimiter = null
+ attributes = []
+ tags = {}
+ additional_tag_map = {}
+ regex_replace_chars = null
+ label_order = []
+ id_length_limit = null
+ label_key_case = null
+ label_value_case = null
+ descriptor_formats = {}
+ # Note: we have to use [] instead of null for unset lists due to
+ # https://github.com/hashicorp/terraform/issues/28137
+ # which was not fixed until Terraform 1.0.0,
+ # but we want the default to be all the labels in `label_order`
+ # and we want users to be able to prevent all tag generation
+ # by setting `labels_as_tags` to `[]`, so we need
+ # a different sentinel to indicate "default"
+ labels_as_tags = ["unset"]
+ }
+ description = <<-EOT
+ Single object for setting entire context at once.
+ See description of individual variables for details.
+ Leave string and numeric variables as `null` to use default value.
+ Individual variable settings (non-null) override settings in context object,
+ except for attributes, tags, and additional_tag_map, which are merged.
+ EOT
+
+ validation {
+ condition = lookup(var.context, "label_key_case", null) == null ? true : contains(["lower", "title", "upper"], var.context["label_key_case"])
+ error_message = "Allowed values: `lower`, `title`, `upper`."
+ }
+
+ validation {
+ condition = lookup(var.context, "label_value_case", null) == null ? true : contains(["lower", "title", "upper", "none"], var.context["label_value_case"])
+ error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
+ }
+}
+
+variable "enabled" {
+ type = bool
+ default = null
+ description = "Set to false to prevent the module from creating any resources"
+}
+
+variable "namespace" {
+ type = string
+ default = null
+ description = "ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique"
+}
+
+variable "tenant" {
+ type = string
+ default = null
+ description = "ID element _(Rarely used, not included by default)_. A customer identifier, indicating who this instance of a resource is for"
+}
+
+variable "environment" {
+ type = string
+ default = null
+ description = "ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT'"
+}
+
+variable "stage" {
+ type = string
+ default = null
+ description = "ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release'"
+}
+
+variable "name" {
+ type = string
+ default = null
+ description = <<-EOT
+ ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
+ This is the only ID element not also included as a `tag`.
+ The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input.
+ EOT
+}
+
+variable "delimiter" {
+ type = string
+ default = null
+ description = <<-EOT
+ Delimiter to be used between ID elements.
+ Defaults to `-` (hyphen). Set to `""` to use no delimiter at all.
+ EOT
+}
+
+variable "attributes" {
+ type = list(string)
+ default = []
+ description = <<-EOT
+ ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,
+ in the order they appear in the list. New attributes are appended to the
+ end of the list. The elements of the list are joined by the `delimiter`
+ and treated as a single ID element.
+ EOT
+}
+
+variable "labels_as_tags" {
+ type = set(string)
+ default = ["default"]
+ description = <<-EOT
+ Set of labels (ID elements) to include as tags in the `tags` output.
+ Default is to include all labels.
+ Tags with empty values will not be included in the `tags` output.
+ Set to `[]` to suppress all generated tags.
+ **Notes:**
+ The value of the `name` tag, if included, will be the `id`, not the `name`.
+ Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
+ changed in later chained modules. Attempts to change it will be silently ignored.
+ EOT
+}
+
+variable "tags" {
+ type = map(string)
+ default = {}
+ description = <<-EOT
+ Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
+ Neither the tag keys nor the tag values will be modified by this module.
+ EOT
+}
+
+variable "additional_tag_map" {
+ type = map(string)
+ default = {}
+ description = <<-EOT
+ Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.
+ This is for some rare cases where resources want additional configuration of tags
+ and therefore take a list of maps with tag key, value, and additional configuration.
+ EOT
+}
+
+variable "label_order" {
+ type = list(string)
+ default = null
+ description = <<-EOT
+ The order in which the labels (ID elements) appear in the `id`.
+ Defaults to ["namespace", "environment", "stage", "name", "attributes"].
+ You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present.
+ EOT
+}
+
+variable "regex_replace_chars" {
+ type = string
+ default = null
+ description = <<-EOT
+ Terraform regular expression (regex) string.
+ Characters matching the regex will be removed from the ID elements.
+ If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits.
+ EOT
+}
+
+variable "id_length_limit" {
+ type = number
+ default = null
+ description = <<-EOT
+ Limit `id` to this many characters (minimum 6).
+ Set to `0` for unlimited length.
+ Set to `null` for keep the existing setting, which defaults to `0`.
+ Does not affect `id_full`.
+ EOT
+ validation {
+ condition = var.id_length_limit == null ? true : var.id_length_limit >= 6 || var.id_length_limit == 0
+ error_message = "The id_length_limit must be >= 6 if supplied (not null), or 0 for unlimited length."
+ }
+}
+
+variable "label_key_case" {
+ type = string
+ default = null
+ description = <<-EOT
+ Controls the letter case of the `tags` keys (label names) for tags generated by this module.
+ Does not affect keys of tags passed in via the `tags` input.
+ Possible values: `lower`, `title`, `upper`.
+ Default value: `title`.
+ EOT
+
+ validation {
+ condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
+ error_message = "Allowed values: `lower`, `title`, `upper`."
+ }
+}
+
+variable "label_value_case" {
+ type = string
+ default = null
+ description = <<-EOT
+ Controls the letter case of ID elements (labels) as included in `id`,
+ set as tag values, and output by this module individually.
+ Does not affect values of tags passed in via the `tags` input.
+ Possible values: `lower`, `title`, `upper` and `none` (no transformation).
+ Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
+ Default value: `lower`.
+ EOT
+
+ validation {
+ condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
+ error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
+ }
+}
+
+variable "descriptor_formats" {
+ type = any
+ default = {}
+ description = <<-EOT
+ Describe additional descriptors to be output in the `descriptors` output map.
+ Map of maps. Keys are names of descriptors. Values are maps of the form
+ `{
+ format = string
+ labels = list(string)
+ }`
+ (Type is `any` so the map values can later be enhanced to provide additional options.)
+ `format` is a Terraform format string to be passed to the `format()` function.
+ `labels` is a list of labels, in order, to pass to `format()` function.
+ Label values will be normalized before being passed to `format()` so they will be
+ identical to how they appear in `id`.
+ Default is `{}` (`descriptors` output will be empty).
+ EOT
+}
+
+#### End of copy of cloudposse/terraform-null-label/variables.tf
diff --git a/examples/complete/main.tf b/examples/complete/main.tf
new file mode 100644
index 0000000..f9d23f1
--- /dev/null
+++ b/examples/complete/main.tf
@@ -0,0 +1 @@
+# complete.tf
diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf
new file mode 100644
index 0000000..f9d23f1
--- /dev/null
+++ b/examples/complete/outputs.tf
@@ -0,0 +1 @@
+# complete.tf
diff --git a/examples/complete/variables.tf b/examples/complete/variables.tf
new file mode 100644
index 0000000..f9d23f1
--- /dev/null
+++ b/examples/complete/variables.tf
@@ -0,0 +1 @@
+# complete.tf
diff --git a/main.tf b/main.tf
new file mode 100644
index 0000000..74e76fd
--- /dev/null
+++ b/main.tf
@@ -0,0 +1,3 @@
+resource "random_pet" "template" {
+ length = var.length
+}
diff --git a/outputs.tf b/outputs.tf
new file mode 100644
index 0000000..c44df14
--- /dev/null
+++ b/outputs.tf
@@ -0,0 +1,4 @@
+output "random_pet_name" {
+ description = "The generated random pet name"
+ value = random_pet.template.id
+}
diff --git a/variables.tf b/variables.tf
new file mode 100644
index 0000000..6348a57
--- /dev/null
+++ b/variables.tf
@@ -0,0 +1,5 @@
+variable "length" {
+ description = "The length of the random name"
+ type = number
+ default = 2
+}
diff --git a/versions.tf b/versions.tf
new file mode 100644
index 0000000..0cf661c
--- /dev/null
+++ b/versions.tf
@@ -0,0 +1,10 @@
+terraform {
+ required_version = ">= 1.0"
+
+ required_providers {
+ random = {
+ source = "hashicorp/random"
+ version = ">= 3.0"
+ }
+ }
+}