Introduction
Network as Code allows for complete separation of data (defining variables) from logic (infrastructure declaration). With little to no knowledge about automation, users can instantiate Meraki cloud-managed networks in minutes, following the intuitive structure of the Meraki Dashboard. This is achieved by separating the *.yaml
files which contain the desired Meraki state from the Terraform Modules which map the definition of the desired state to Terraform resources. The data model and modules used in Network as Code are open-source and available as-is.
The tree
output below shows an example of a data model where the *.yaml
files compose logical groups that map to constructs that Meraki users are very familiar with.
Directorydata
- organizations.nac.yaml
- networks.nac.yaml
- devices.nac.yaml
- networks_wireless.nac.yaml
- networks_switch.nac.yaml
- networks_appliance.nac.yaml
- defaults.nac.yaml
- main.tf
Configuration for a network with wireless SSIDs and switch settings can simply be managed via the respective *.nac.yaml
files:
---meraki: domains: - name: "cisco.com" # Replace with your domain administrator: name: "admin@cisco.com" # Replace with your admin email organizations: - name: "Demo Organization" networks: - name: "Branch-Office-Demo" product_types: - appliance - switch - wireless time_zone: "America/Los_Angeles" notes: "Branch office demo network" tags: - demo - branch wireless: ssids: - name: "Corporate-WiFi" ssid_number: "0" enabled: true auth_mode: "psk" psk: "DemoPassword123" encryption_mode: "wpa" wpa_encryption_mode: "WPA2 only" use_vlan_tagging: true default_vlan_id: 100 - name: "Guest-WiFi" ssid_number: "1" enabled: true auth_mode: "open" splash_page: "Click-through splash page" appliance: vlans: - vlan_id: 100 name: "Data VLAN" subnet: "10.1.100.0/24" appliance_ip: "10.1.100.1" dhcp_handling: "Run a DHCP server" dhcp_lease_time: "1 day" - vlan_id: 200 name: "Voice VLAN" subnet: "10.1.200.0/24" appliance_ip: "10.1.200.1" dhcp_handling: "Run a DHCP server" dhcp_lease_time: "1 day"
Key Benefits
Cloud-Native Management: Leverage Meraki’s cloud-managed approach with Infrastructure as Code principles, enabling automated deployment and management of wireless, switching, and security appliance configurations.
Declarative Configuration: Define your desired network state in human-readable YAML files that map directly to Meraki Dashboard concepts like organizations, networks, devices, and policies.
Scalable Architecture: Manage multiple organizations, networks, and thousands of devices through version-controlled configuration files, enabling consistent deployments across sites.
API-Driven Automation: Built on the robust Meraki Dashboard API, providing real-time configuration management and monitoring capabilities.
Default Values and Customization with Site Blueprints
The module ships with default values for certain objects. These values are documented in the Data Model section on this page. A single file defaults.nac.yaml
can be used to define specific requirements in a central location. This will overwrite any default values that come with the main modules.
This file is typically customized to reflect the specific user requirements and reduces the overall size of input files as optional parameters with a default value can be omitted.