From 445cecb501eccb7698941ee6d33f0ec302db3b4c Mon Sep 17 00:00:00 2001 From: danischm Date: Thu, 16 May 2024 15:18:05 +0200 Subject: [PATCH] Initial commit --- .github/dependabot.yml | 10 ++ .github/workflows/test.yml | 60 +++++++ .gitignore | 7 + .pre-commit-config.yaml | 17 ++ .terraform-docs.yml | 41 +++++ CHANGELOG.md | 3 + LICENSE | 176 +++++++++++++++++++++ README.md | 73 +++++++++ defaults/defaults.yaml | 8 + examples/administrator/.terraform-docs.yml | 38 +++++ examples/administrator/README.md | 43 +++++ examples/administrator/main.tf | 6 + examples/administrator/organization.yaml | 8 + examples/administrator/versions.tf | 3 + main.tf | 3 + meraki_organization.tf | 65 ++++++++ merge.tf | 35 ++++ outputs.tf | 10 ++ variables.tf | 23 +++ versions.tf | 18 +++ 20 files changed, 647 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 .terraform-docs.yml create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 defaults/defaults.yaml create mode 100644 examples/administrator/.terraform-docs.yml create mode 100644 examples/administrator/README.md create mode 100644 examples/administrator/main.tf create mode 100644 examples/administrator/organization.yaml create mode 100644 examples/administrator/versions.tf create mode 100644 main.tf create mode 100644 meraki_organization.tf create mode 100644 merge.tf create mode 100644 outputs.tf create mode 100644 variables.tf create mode 100644 versions.tf diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bdb81a8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..cded6b3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,60 @@ +name: Tests +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + static: + name: Tests + runs-on: ubuntu-latest + timeout-minutes: 10 + concurrency: testing_environment + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Python Setup + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Terraform Setup + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.5.7 + + - name: Tflint Setup + uses: terraform-linters/setup-tflint@v4 + + - name: Terraform Docs Setup + run: | + mkdir terraform-docs && cd terraform-docs + curl -sSLo terraform-docs.tar.gz https://terraform-docs.io/dl/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz + tar -xzf terraform-docs.tar.gz + chmod +x terraform-docs + echo "$GITHUB_WORKSPACE/terraform-docs" >> $GITHUB_PATH + + - name: Pre-commit Checks + uses: pre-commit/action@v3.0.1 + + - name: Terraform Init + run: terraform init -input=false -no-color + + - name: Terraform Validate + run: terraform validate -no-color + + - name: Webex Notification + if: always() && github.event_name != 'pull_request' + uses: qsnyder/action-wxt@master + env: + TOKEN: ${{ secrets.WEBEX_TOKEN }} + ROOMID: ${{ secrets.WEBEX_ROOM_ID }} + MESSAGE: | + [**[${{ job.status }}] ${{ github.repository }} #${{ github.run_number }}**](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + * Commit: [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})[${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) + * Author: ${{ github.event.sender.login }} + * Branch: ${{ github.ref }} ${{ github.head_ref }} + * Event: ${{ github.event_name }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..11a0827 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.log +.terraform +.terraform.lock.hcl +terraform.tfstate +terraform.tfstate.backup +.envrc +tflint.hcl diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8692346 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +--- +repos: + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.62.3 + hooks: + - id: terraform_fmt + args: + - --args=-recursive + - id: terraform_tflint + + - repo: https://github.com/terraform-docs/terraform-docs + rev: v0.16.0 + hooks: + - id: terraform-docs-system + args: ["./examples/administrator"] + - id: terraform-docs-system + args: ["."] diff --git a/.terraform-docs.yml b/.terraform-docs.yml new file mode 100644 index 0000000..7d9c6cf --- /dev/null +++ b/.terraform-docs.yml @@ -0,0 +1,41 @@ +version: ">= 0.14.0" + +formatter: markdown table + +content: |- + # Terraform Network-as-Code Cisco Meraki Module + + A Terraform module to configure Cisco Meraki. + + ## Usage + + This module supports an inventory driven approach, where a complete Meraki configuration or parts of it are either modeled in one or more YAML files or natively using Terraform variables. + + ## Examples + + Configuring an organization administrator using YAML: + + #### `organization.yaml` + + ```yaml + {{ include "./examples/administrator/organization.yaml" }} + ``` + + #### `main.tf` + + ```hcl + {{ include "./examples/administrator/main.tf" }} + ``` + + {{ .Requirements }} + {{ .Inputs }} + {{ .Outputs }} + {{ .Resources }} + {{ .Modules }} +output: + file: README.md + mode: replace + +sort: + enabled: true + by: required diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d8fc569 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 (unreleased) + +- Initial release diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d9a10c0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ + 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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..6325d01 --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ + +# Terraform Network-as-Code Cisco Meraki Module + +A Terraform module to configure Cisco Meraki. + +## Usage + +This module supports an inventory driven approach, where a complete Meraki configuration or parts of it are either modeled in one or more YAML files or natively using Terraform variables. + +## Examples + +Configuring an organization administrator using YAML: + +#### `organization.yaml` + +```yaml +meraki: + organizations: + - name: MyOrg1 + administrators: + - name: Admin1 + email: admin@cisco.com + networks: + - name: MyNet1 +``` + +#### `main.tf` + +```hcl +module "meraki" { + source = "netascode/nac-meraki/meraki" + version = ">= 0.1.0" + + yaml_files = ["organization.yaml"] +} +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.3.0 | +| [local](#requirement\_local) | >= 2.3.0 | +| [meraki](#requirement\_meraki) | 0.2.0-alpha | +| [utils](#requirement\_utils) | >= 0.2.5 | +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [model](#input\_model) | As an alternative to YAML files, a native Terraform data structure can be provided as well. | `map(any)` | `{}` | no | +| [write\_default\_values\_file](#input\_write\_default\_values\_file) | Write all default values to a YAML file. Value is a path pointing to the file to be created. | `string` | `""` | no | +| [yaml\_directories](#input\_yaml\_directories) | List of paths to YAML directories. | `list(string)` | `[]` | no | +| [yaml\_files](#input\_yaml\_files) | List of paths to YAML files. | `list(string)` | `[]` | no | +## Outputs + +| Name | Description | +|------|-------------| +| [default\_values](#output\_default\_values) | All default values. | +| [model](#output\_model) | Full model. | +## Resources + +| Name | Type | +|------|------| +| [local_sensitive_file.defaults](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource | +| [meraki_networks.networks](https://registry.terraform.io/providers/cisco-open/meraki/0.2.0-alpha/docs/resources/networks) | resource | +| [meraki_organizations_admins.organizations_admins](https://registry.terraform.io/providers/cisco-open/meraki/0.2.0-alpha/docs/resources/organizations_admins) | resource | +| [meraki_organizations.organizations](https://registry.terraform.io/providers/cisco-open/meraki/0.2.0-alpha/docs/data-sources/organizations) | data source | +| [utils_yaml_merge.defaults](https://registry.terraform.io/providers/netascode/utils/latest/docs/data-sources/yaml_merge) | data source | +| [utils_yaml_merge.model](https://registry.terraform.io/providers/netascode/utils/latest/docs/data-sources/yaml_merge) | data source | +## Modules + +No modules. + \ No newline at end of file diff --git a/defaults/defaults.yaml b/defaults/defaults.yaml new file mode 100644 index 0000000..e75869d --- /dev/null +++ b/defaults/defaults.yaml @@ -0,0 +1,8 @@ +defaults: + meraki: + organizations: + administrators: + authentication_method: Email + organization_access: full + networks: + access: full diff --git a/examples/administrator/.terraform-docs.yml b/examples/administrator/.terraform-docs.yml new file mode 100644 index 0000000..6f432e0 --- /dev/null +++ b/examples/administrator/.terraform-docs.yml @@ -0,0 +1,38 @@ +version: ">= 0.14.0" + +formatter: markdown table + +content: |- + # Meraki Organization Administrator Example + + Set environment variables with the Meraki Dashboard API key: + + ```bash + export MERAKI_DASHBOARD_API_KEY=ABC123 + ``` + + To run this example you need to execute: + + ```bash + $ terraform init + $ terraform plan + $ terraform apply + ``` + + Note that this example will create resources. Resources can be destroyed with `terraform destroy`. + + #### `organization.yaml` + + ```yaml + {{ include "./organization.yaml" }} + ``` + + #### `main.tf` + + ```hcl + {{ include "./main.tf" }} + ``` + +output: + file: README.md + mode: replace diff --git a/examples/administrator/README.md b/examples/administrator/README.md new file mode 100644 index 0000000..c104f44 --- /dev/null +++ b/examples/administrator/README.md @@ -0,0 +1,43 @@ + +# Meraki Organization Administrator Example + +Set environment variables with the Meraki Dashboard API key: + +```bash +export MERAKI_DASHBOARD_API_KEY=ABC123 +``` + +To run this example you need to execute: + +```bash +$ terraform init +$ terraform plan +$ terraform apply +``` + +Note that this example will create resources. Resources can be destroyed with `terraform destroy`. + +#### `organization.yaml` + +```yaml +meraki: + organizations: + - name: MyOrg1 + administrators: + - name: Admin1 + email: admin@cisco.com + networks: + - name: MyNet1 +``` + +#### `main.tf` + +```hcl +module "meraki" { + source = "netascode/nac-meraki/meraki" + version = ">= 0.1.0" + + yaml_files = ["organization.yaml"] +} +``` + \ No newline at end of file diff --git a/examples/administrator/main.tf b/examples/administrator/main.tf new file mode 100644 index 0000000..700e88e --- /dev/null +++ b/examples/administrator/main.tf @@ -0,0 +1,6 @@ +module "meraki" { + source = "netascode/nac-meraki/meraki" + version = ">= 0.1.0" + + yaml_files = ["organization.yaml"] +} diff --git a/examples/administrator/organization.yaml b/examples/administrator/organization.yaml new file mode 100644 index 0000000..36214fa --- /dev/null +++ b/examples/administrator/organization.yaml @@ -0,0 +1,8 @@ +meraki: + organizations: + - name: MyOrg1 + administrators: + - name: Admin1 + email: admin@cisco.com + networks: + - name: MyNet1 diff --git a/examples/administrator/versions.tf b/examples/administrator/versions.tf new file mode 100644 index 0000000..12ad22a --- /dev/null +++ b/examples/administrator/versions.tf @@ -0,0 +1,3 @@ +terraform { + required_version = ">= 1.3.0" +} diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..5292982 --- /dev/null +++ b/main.tf @@ -0,0 +1,3 @@ +locals { + meraki = try(local.model.meraki, {}) +} diff --git a/meraki_organization.tf b/meraki_organization.tf new file mode 100644 index 0000000..c83db73 --- /dev/null +++ b/meraki_organization.tf @@ -0,0 +1,65 @@ +data "meraki_organizations" "organizations" { +} + +locals { + organization_map = { for organization in data.meraki_organizations.organizations.items : organization.name => organization.id } + networks = flatten([ + for org in try(local.meraki.organizations, []) : [ + for network in try(org.networks, []) : { + key = format("%s/%s", org.name, network.name) + organization_id = local.organization_map[org.name] + name = try(network.name, local.defaults.meraki.organizations.networks.name) + notes = try(network.notes, local.defaults.meraki.organizations.networks.notes) + product_types = try(network.product_types, local.defaults.meraki.organizations.networks.product_types) + tags = try(network.tags, local.defaults.meraki.organizations.networks.tags) + time_zone = try(network.timezone, local.defaults.meraki.organizations.networks.timezone) + } + ] + ]) +} + +resource "meraki_networks" "networks" { + for_each = { for network in local.networks : network.key => network } + + name = each.value.name + notes = each.value.notes + organization_id = each.value.organization_id + product_types = each.value.product_types + tags = each.value.tags + time_zone = each.value.time_zone +} + +locals { + admins = flatten([ + for org in try(local.meraki.organizations, []) : [ + for admin in try(org.administrators, []) : { + key = format("%s/%s", org.name, admin.name) + organization_id = local.organization_map[org.name] + name = try(admin.name, local.defaults.meraki.organizations.administrators.name) + email = try(admin.email, local.defaults.meraki.organizations.administrators.email) + authentication_method = try(admin.authentication_method, local.defaults.meraki.organizations.administrators.authentication_method) + org_access = try(admin.organization_access, local.defaults.meraki.organizations.administrators.organization_access) + networks = [for network in try(admin.networks, []) : { + id = meraki_networks.networks["${org.name}/${network.name}"].id + access = try(network.access, local.defaults.meraki.organizations.administrators.networks.access) + }] + tags = [for tag in try(admin.tags, []) : { + tag = tag.name + access = try(tag.access, local.defaults.meraki.organizations.administrators.tags.access) + }] + } + ] + ]) +} + +resource "meraki_organizations_admins" "organizations_admins" { + for_each = { for admin in local.admins : admin.key => admin } + + organization_id = each.value.organization_id + name = each.value.name + email = each.value.email + authentication_method = each.value.authentication_method + org_access = each.value.org_access + networks = each.value.networks + tags = each.value.tags +} diff --git a/merge.tf b/merge.tf new file mode 100644 index 0000000..6a3e941 --- /dev/null +++ b/merge.tf @@ -0,0 +1,35 @@ +locals { + yaml_strings_directories = flatten([ + for dir in var.yaml_directories : [ + for file in fileset(".", "${dir}/*.{yml,yaml}") : file(file) + ] + ]) + yaml_strings_files = [ + for file in var.yaml_files : file(file) + ] + model_strings = length(keys(var.model)) != 0 ? [yamlencode(var.model)] : [] + user_defaults = { "defaults" : try(yamldecode(data.utils_yaml_merge.model.output)["defaults"], {}) } + defaults = yamldecode(data.utils_yaml_merge.defaults.output)["defaults"] + model = yamldecode(data.utils_yaml_merge.model.output) +} + +data "utils_yaml_merge" "model" { + input = concat(local.yaml_strings_directories, local.yaml_strings_files, local.model_strings) + + lifecycle { + precondition { + condition = length(var.yaml_directories) != 0 || length(var.yaml_files) != 0 || length(keys(var.model)) != 0 + error_message = "Either `yaml_directories`,`yaml_files` or a non-empty `model` value must be provided." + } + } +} + +data "utils_yaml_merge" "defaults" { + input = [file("${path.module}/defaults/defaults.yaml"), yamlencode(local.user_defaults)] +} + +resource "local_sensitive_file" "defaults" { + count = var.write_default_values_file != "" ? 1 : 0 + content = data.utils_yaml_merge.defaults.output + filename = var.write_default_values_file +} diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..8331c73 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,10 @@ + +output "default_values" { + description = "All default values." + value = local.defaults +} + +output "model" { + description = "Full model." + value = local.model +} diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..ac749f3 --- /dev/null +++ b/variables.tf @@ -0,0 +1,23 @@ +variable "yaml_directories" { + description = "List of paths to YAML directories." + type = list(string) + default = [] +} + +variable "yaml_files" { + description = "List of paths to YAML files." + type = list(string) + default = [] +} + +variable "model" { + description = "As an alternative to YAML files, a native Terraform data structure can be provided as well." + type = map(any) + default = {} +} + +variable "write_default_values_file" { + description = "Write all default values to a YAML file. Value is a path pointing to the file to be created." + type = string + default = "" +} diff --git a/versions.tf b/versions.tf new file mode 100644 index 0000000..e69ddff --- /dev/null +++ b/versions.tf @@ -0,0 +1,18 @@ +terraform { + required_version = ">= 1.3.0" + + required_providers { + meraki = { + source = "cisco-open/meraki" + version = "0.2.0-alpha" + } + utils = { + source = "netascode/utils" + version = ">= 0.2.5" + } + local = { + source = "hashicorp/local" + version = ">= 2.3.0" + } + } +}