Skip to content

netascode/nac-meraki-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

nac-meraki-example

Sample Meraki as Code repository for the Meraki as Code Learning Lab.

Overview

This repository provides a ready-to-use project structure for managing Meraki infrastructure as code. It uses Terraform, YAML data models, and the NaC Meraki module to declaratively define and deploy configuration to the Meraki Dashboard.

Repository Structure

.
├── .ci/                   # CI/CD helper scripts (GitLab comments, Webex notifications)
├── data/                  # Your YAML data model files go here (empty by default)
├── lab-data/              # Pre-built YAML files for each lab exercise step
├── rules/                 # Custom nac-validate Python rules for semantic validation
├── workspaces/            # Separate Terraform workspace for template rendering
├── tests/                 # Templates for post-deployment testing with nac-test
├── .gitlab-ci.yml         # GitLab CI/CD pipeline definition
├── main.tf                # Root Terraform configuration
├── schema.yaml            # YAML schema for data model validation
└── LICENSE

Prerequisites

  • Terraform >= 1.9.0 (or OpenTofu)
  • Python 3.12
  • Meraki API Key with full write access (Enable API access)

Quick Start

Clone and switch to the repository:

git clone --depth 1 https://github.com/netascode/nac-meraki-example meraki-as-code
cd meraki-as-code

Set environment variables (create a .env file):

export MERAKI_API_KEY=<your_api_key>
export secret_password=<your_secret_in_datamodel>
export org_email=<your_email>
source .env

Copy the desired configuration from lab-data/ into the data/ folder:

cp lab-data/01_create_org.nac.yaml data/

Validate, plan, deploy, and test:

nac-validate --non-strict -s schema.yaml -r rules/ data/
terraform init
terraform plan
terraform apply
nac-test --templates tests/ --data data/ --output test_results

Key References

License

See the LICENSE file for details.

About

Sample Meraki as Code repository

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages