From 5a945dcd1da242f6c2c012d12f6877143404aaae Mon Sep 17 00:00:00 2001 From: Piotr Stawarski Date: Fri, 6 Oct 2023 10:45:24 +0200 Subject: [PATCH] Initial commit --- .envrc | 7 + .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.yml | 58 ++++++ .github/ISSUE_TEMPLATE/config.yml | 5 + .github/ISSUE_TEMPLATE/feature_request.yml | 40 ++++ .github/PULL_REQUEST_TEMPLATE.md | 26 +++ .github/img/OPSD_logo.svg | 16 ++ .github/release-drafter.yml | 41 +++++ .github/workflows/release-drafter.yml | 27 +++ .github/workflows/static-code-analysis.yml | 22 +++ .gitignore | 30 +++ .pre-commit-config.yaml | 62 +++++++ .terraform-docs.yml | 31 ++++ .tflint.hcl | 23 +++ .tool-versions | 4 + LICENSE | 201 +++++++++++++++++++++ README.md | 73 ++++++++ examples/example_of_use/.tool-versions | 1 + examples/example_of_use/README.mkdn | 63 +++++++ examples/example_of_use/main.tf | 4 + examples/example_of_use/versions.tf | 13 ++ main.tf | 1 + outputs.tf | 4 + variables.tf | 12 ++ versions.tf | 13 ++ 25 files changed, 778 insertions(+) create mode 100644 .envrc create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/img/OPSD_logo.svg create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/static-code-analysis.yml create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 .terraform-docs.yml create mode 100644 .tflint.hcl create mode 100644 .tool-versions create mode 100644 LICENSE create mode 100644 README.md create mode 100644 examples/example_of_use/.tool-versions create mode 100644 examples/example_of_use/README.mkdn create mode 100644 examples/example_of_use/main.tf create mode 100644 examples/example_of_use/versions.tf create mode 100644 main.tf create mode 100644 outputs.tf create mode 100644 variables.tf create mode 100644 versions.tf diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..cdc6862 --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +# +# https://direnv.net/ +# + +pre-commit install + +source_env_if_exists .envrc.private diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..4606411 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @opsd-io/terraformers diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..5a6577c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,58 @@ +name: Bug report +description: File a bug/issue +title: "[BUG]: " +labels: ["bug"] +body: +- type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Are there other open or closed issues or Pull Requests that match your issue? + options: + - label: I have searched the existing issues + required: true +- type: textarea + attributes: + label: Current Behavior + description: In a few words, describe the problem you are struggling with. + validations: + required: false +- type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: false +- type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. In this environment... + 2. With this config... + 3. Run '...' + 4. See error... + validations: + required: false +- type: textarea + attributes: + label: Environment + description: | + examples: + - **Terraform version**: 1.3.0 + - **Terraform provider version**: 4.0 + value: | + - Terraform version: 0.0.0 + - Terraform provider version: 0.0 + render: markdown + validations: + required: true +- type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + **Tip**: You can attach images or log files by clicking this area to highlight it and then dragging files in. + **Tip**: You can use GitHub Gist to share debug output. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..fc8b688 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Join to the OPSd community on Slack + url: https://join.slack.com/t/opsd-community/signup + about: If you want to contact us personally join our Slack. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..00ea279 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,40 @@ +name: Feature request +description: Suggest new functionality +title: "[FEATURE]: " +labels: ["enhancement"] +body: +- type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Are there other open or closed issues or Pull Requests that match your suggestion? + options: + - label: I have searched the existing issues + required: true +- type: textarea + attributes: + label: Is your feature request related to a problem? Please describe + description: A clear and concise description of what the problem is. + validations: + required: true +- type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + validations: + required: true +- type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + validations: + required: true +- type: textarea + attributes: + label: Anything else? + description: | + Links? References? Mockups? Anything that will give us more context about the feature you are encountering! + + **Tip**: You can attach images or log files by clicking this area to highlight it and then dragging files in. + **Tip**: You can use GitHub Gist to share your concepts/ideas. + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..7f27e9a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ +## What changes does your PR bring? + +In a few words, describe what changes your commits make to the code. + +## Type of change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] Chore (non-breaking change to the build process or auxiliary tools) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Documentation (Improvements or additions to documentation) +- [ ] Breaking change (fix or feature that would cause existing functionality not to work as expected) + +## References + +Fixes: + +# Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented on my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published in downstream modules diff --git a/.github/img/OPSD_logo.svg b/.github/img/OPSD_logo.svg new file mode 100644 index 0000000..b57e682 --- /dev/null +++ b/.github/img/OPSD_logo.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..1fd2e57 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,41 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +template: | + ## Changes + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION + +categories: + - title: 'Features' + labels: + - 'enhancement' + - title: 'Bug Fixes' + labels: + - 'bug' + - title: 'Documentation' + labels: + - 'documentation' + - title: 'Maintenance' + label: 'chore' + collapse-after: 5 + +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. + +version-resolver: + major: + labels: + - 'breaking' + minor: + labels: + - 'enhancement' + patch: + labels: + - 'bug' + - 'documentation' + - 'chore' + +exclude-labels: + - 'skip-changelog' diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..35fefe0 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,27 @@ +name: Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - main + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + pull-requests: write + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "main" + - uses: release-drafter/release-drafter@v5 + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + with: + config-name: release-drafter.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/static-code-analysis.yml b/.github/workflows/static-code-analysis.yml new file mode 100644 index 0000000..2e0ecb7 --- /dev/null +++ b/.github/workflows/static-code-analysis.yml @@ -0,0 +1,22 @@ +name: Static code analysis + +on: + pull_request: + paths-ignore: + - "**.svg" + # push: + # # paths-ignore: + # # - "**.md" + +jobs: + tools: + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v3 + - name: Install all the tools from .tool-versions file + uses: asdf-vm/actions/install@v2 + - name: Install python for pre-commit purposes + uses: actions/setup-python@v4 + - name: Exectute all the pre-commit tasks from .pre-commit-config.yaml file + uses: pre-commit/action@v3.0.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9068df4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Terraform + +## local directories +.terraform*/ +.terraform/ + +# lock & state files +.terraform.lock.hcl +*.tfstate +*.tfstate.* + +# Code Editors + +## VI +*.swp + +## Visual Studio Code +*.code-workspace + +# Misc + +## MacOS +**/.DS_Store +**/.CFUserTextEncoding +**/.Trash/ +**/$RECYCLE.BIN/ + +## direnv +/.envrc.private +/.direnv/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1628a79 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,62 @@ +repos: + # Pre-commit hooks + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 # See the release notes at https://github.com/pre-commit/pre-commit-hooks/releases + hooks: + - id: end-of-file-fixer + name: end of file fixer + description: Let's be sure that a new line has been added to the end of the file. + - id: trailing-whitespace + name: trailing whitespace + description: Automatically remove trailing whitespace before committing. + - id: check-merge-conflict + name: check merge conflict + description: Check for files that contain merge conflict strings. + stages: [commit] + - id: check-executables-have-shebangs + name: check executables have shebangs + description: Checks that non-binary executables have a proper shebang. + stages: [commit] + - id: detect-private-key + name: detect private key + description: Checks for the existence of private keys. + stages: [commit] + - id: check-symlinks + name: check symlinks + description: Checks for symlinks which do not point to anything. + stages: [commit] + - id: mixed-line-ending + name: mixed line ending + description: Replaces or checks mixed line ending. + stages: [commit] + - id: check-yaml + name: check yaml + description: checks yaml files for parseable syntax. + entry: check-yaml + language: python + types: [yaml] + + # Terraform + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.82.0 # See the release notes at https://github.com/antonbabenko/pre-commit-terraform/releases + hooks: + - id: terraform_fmt + name: terraform fmt + description: Checks if the terraform code format is valid. + stages: [commit] + - id: terraform_tflint + name: terraform tflint + description: Automatic terraform linting. + stages: [commit] + exclude: (examples) + - id: terraform_validate + name: terraform validate + description: Terraform code validator. + stages: [commit] + exclude: (examples) + - id: terraform_docs + name: terraform docs + description: Generates terraform documentation. + args: + - --args=--config=.terraform-docs.yml + stages: [commit] diff --git a/.terraform-docs.yml b/.terraform-docs.yml new file mode 100644 index 0000000..c1c473f --- /dev/null +++ b/.terraform-docs.yml @@ -0,0 +1,31 @@ +--- +formatter: markdown table + +version: ">= 0.16.0, < 1.0.0" + +output: + file: README.md + mode: inject + template: |- + + {{ .Content }} + + +sort: + enabled: true + by: name + +settings: + anchor: true + color: true + default: true + description: false + escape: true + hide-empty: false + html: true + indent: 2 + lockfile: false + read-comments: true + required: true + sensitive: true + type: true diff --git a/.tflint.hcl b/.tflint.hcl new file mode 100644 index 0000000..24e529f --- /dev/null +++ b/.tflint.hcl @@ -0,0 +1,23 @@ +config { + format = "compact" + module = false + force = false +} + +# Enable all rules, always. The bundled plugin uses only recommended. +plugin "terraform" { + enabled = true + preset = "all" +} + +# Enforces module version pinning. +rule "terraform_module_pinned_source" { + enabled = true + style = "semver" +} + +# Enforces naming conventions. +rule "terraform_naming_convention" { + enabled = true + format = "snake_case" +} diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..580373a --- /dev/null +++ b/.tool-versions @@ -0,0 +1,4 @@ +terraform 1.5.5 +terraform-docs 0.16.0 +tflint 0.47.0 +pre-commit 3.3.3 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7b2c40b --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + 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 [2022] [ZeroDowntime Sp. z o.o.] + + 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..f6cb368 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +OPSd + +Meet **OPSd**. The unique and effortless way of managing cloud infrastructure. + +# terraform-module-template + +## Introduction + +What does the module provide? + +## Usage + +```hcl +module "module_name" { + source = "github.com/opsd-io/module_name?ref=v0.0.1" + + # Variables + variable_1 = "foo" + variable_2 = "bar" +} +``` + +**IMPORTANT**: Make sure not to pin to master because there may be breaking changes between releases. + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.3.1 | + +## Providers + +No providers. + +## Modules + +No modules. + +## Resources + +No resources. + +## Inputs + +No inputs. + +## Outputs + +No outputs. + + +## Examples of usage + +Do you want to see how the module works? See all the [usage examples](examples). + +## Related modules + +The list of related modules (if present). + +## Contributing + +If you are interested in contributing to the project, see see our [guide](https://github.com/opsd-io/contribution). + +## Support + +If you have a problem with the module or want to propose a new feature, you can report it via the project's (Github) issue tracker. + +If you want to discuss something in person, you can join our community on [Slack](https://join.slack.com/t/opsd-community/signup). + +## License + +[Apache License 2.0](LICENSE) diff --git a/examples/example_of_use/.tool-versions b/examples/example_of_use/.tool-versions new file mode 100644 index 0000000..0743dde --- /dev/null +++ b/examples/example_of_use/.tool-versions @@ -0,0 +1 @@ +terraform 1.5.5 diff --git a/examples/example_of_use/README.mkdn b/examples/example_of_use/README.mkdn new file mode 100644 index 0000000..fc28c30 --- /dev/null +++ b/examples/example_of_use/README.mkdn @@ -0,0 +1,63 @@ +# Example title + +Brief description of an example. + +## Required tools + +### AZ CLI + +Before you start, you need to install Azure CLI according to the official [documentation](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli). + +Use the `az login` command to login to your Azure subscription. + +### asdf and direnv + +Additinaly `asdf` and `direnv` must be installed and configured according to their official documentation. + +- [asdf](https://asdf-vm.com/) - manages multiple runtime versions; +- [direnv](https://direnv.net/) - augments existing shells with a new feature that can load and unload environment variables. + +### Terraform + +The suggested Terraform version is defined in the [.tool-versions](.tool-versions) file. +To install it, simply execute + +```bash +asdf install terraform +``` + +## Terraforming infrastructure + +To start working with the module, you need to initialize terraform. + +```shell +terraform init +``` + +Execute plan command. + +```shell +terraform plan +``` + +and verify what will be created. + +The last step is to create the repo + +```shell +terrafrorm apply +``` + +**IMPORTANT**: Please double-check the command output. The vital section can be seen in the example `Plan: 6 to add, 0 to change, 0 to destroy`. Ensure that you understand the changes you are making. + +Next, you will be asked + +```shell +Do you want to perform these actions? + Terraform will perform the actions described above. + Only 'yes' will be accepted to approve. + + Enter a value: +``` + +Type `yes` to approve and let the magic happen. diff --git a/examples/example_of_use/main.tf b/examples/example_of_use/main.tf new file mode 100644 index 0000000..9eda987 --- /dev/null +++ b/examples/example_of_use/main.tf @@ -0,0 +1,4 @@ +module "module_name" { + source = "../../" + +} diff --git a/examples/example_of_use/versions.tf b/examples/example_of_use/versions.tf new file mode 100644 index 0000000..b7d3369 --- /dev/null +++ b/examples/example_of_use/versions.tf @@ -0,0 +1,13 @@ +terraform { + required_version = ">= 1.3.1" + required_providers { + # github = { + # source = "integrations/github" + # version = ">= 5.3.0" + # } + # azurerm = { + # source = "hashicorp/azurerm" + # version = ">= 3.22.0" + # } + } +} diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..1c6a2e5 --- /dev/null +++ b/main.tf @@ -0,0 +1 @@ +# Terraform code goes here diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..47cec5f --- /dev/null +++ b/outputs.tf @@ -0,0 +1,4 @@ +# output "variable" { +# description = "output variable description" +# value = variable.main.name +# } diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..a27d76b --- /dev/null +++ b/variables.tf @@ -0,0 +1,12 @@ +# variable "variable_name" { +# description = "variable description" +# type = number +# default = 1 +# } + +# variable "variable_password" { +# description = "variable description" +# type = string +# sensitive = true +# default = "abc" +# } diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..b7d3369 --- /dev/null +++ b/versions.tf @@ -0,0 +1,13 @@ +terraform { + required_version = ">= 1.3.1" + required_providers { + # github = { + # source = "integrations/github" + # version = ">= 5.3.0" + # } + # azurerm = { + # source = "hashicorp/azurerm" + # version = ">= 3.22.0" + # } + } +}